sharepoint list无法使用javascript写入

时间:2014-04-17 20:00:45

标签: javascript sharepoint sharepoint-2010

我在SharePoint中创建了一个测试应用程序,它将显示测试,对其进行评级,然后将测试分数保存回SharePoint。我的老板认为,如果我们能够审查输入的问题和答案,那就太好了。我创建了一个包含156行的新列表,78个多行行用于问题,78个是/否用于正确与否。在委托函数上我得到一个错误,

  

"专栏" q1"不存在。它可能已被另一个删除   用户......"

我可以向你保证q1栏确实存在。关于这个问题的任何想法?

function updatedRecordedResults(graded) {
   graded = ingraded;
   var currentContext = new getContext(); //gets current context of SP site
   var oList = currentContext.web.get_lists().getByTitle(window.recordedResults); //gets      the list by name

   var itemCreateInfo = new SP.ListItemCreationInformation();
   this.oListItem = oList.addItem(itemCreateInfo);
   this.oListItem.set_item("Title", window.user);

   for (var i = 0; i < graded.length; i++) {
       oListItem.set_item("q" + (i + 1), window.globalTest[i].question);
       oListItem.set_item((i + 1) + "a", graded[i]);
   }

   oListItem.update();

   currentContext.context.load(oListItem);
   currentContext.context.executeQueryAsync(Function.createDelegate(this, this.updateRecordedResults), Function.createDelegate(this, this.failedupdateRecordedResults));
}

function updateRecordedResults() {
   alert("succeeded");
}

function failedupdateRecordedResults(sender, args) {
   alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}

1 个答案:

答案 0 :(得分:0)

如果在SharePoint上保存后更改列名或列表名,则javascript将无法再访问它。通过首先在Excel工作表中创建列表并将其上传到网站,我可以防止在设计器中重命名列名。

相关问题