嗨,我正在尝试使用SPServices创建共享点列表,并且我已经创建了部分。
接下来,我需要在创建过程中或之后添加新列。但是我无法使添加的新文件起作用。
var fieldsNew = "<Fields><Method ID='1'><Field Type='Text' List='{7B4575c08a-0a82-4ed6-a367-102fa380aedf}' ShowField='ID' DisplayName='MatchedEquipmentRecord'></Field></Method></Fields>";
$().SPServices({
operation: "UpdateList",
listName: "myfirstList",
listProperties:"",
updateFields: "",
newFields: fieldsNew,
deleteFields: "",
listVersion: "",
async: false,
completefunc: function (xData, Status){
alert(xData.status);
alert(xData.responseText);
}
});
我从警报(xData.status)返回了200条代码;据我所知,这是一个成功的代码,但是当我查看列表时,它并不存在。
答案 0 :(得分:0)
$().SPServices({
operation: "AddList",
async: false,
listName: "myfirstList",
description: "....",
templateID: "100",
completefunc: function(xData, Status)
{
if (xData.status == 200)
{
alert(strListName + ' List created successfully');
} else
{
alert(xData.status);
alert(xData.responseText);
}
}
});
var fieldsToUpdate = '<Fields>';
fieldsToUpdate += '<Method ID="1"><Field Type="Text" Name="Application Family" DisplayName="Applicationfamily"><Default></Default></Field></Method>';
fieldsToUpdate += '<Method ID="2"><Field Type="Text" Name="Manufacturer" DisplayName="Manufacturer"><Default></Default></Field></Method>';
fieldsToUpdate += '<Method ID="3"><Field Type="Text" Name="Description" DisplayName="Description"><Default></Default></Field></Method>';
fieldsToUpdate += '<Method ID="4"><Field Type="Text" Name="Software Tag" DisplayName="TAG"><Default></Default></Field></Method>';
fieldsToUpdate += '<Method ID="5"><Field Type="Text" Name="software Type" DisplayName="SoftwareClass"><Default></Default></Field></Method>';
fieldsToUpdate += '<Method ID="6"><Field Type="Text" Name="Status" DisplayName="Status"><Default></Default></Field></Method>';
fieldsToUpdate += '</Fields>';
$().SPServices({
operation: "UpdateList",
listName: "myfirstList",
listProperties:"",
updateFields: "",
newFields: fieldsToUpdate,
deleteFields: "",
listVersion: "",
async: false,
completefunc: function (xData, Status){
alert(xData.status);
}
});
我已修复它现在可以正常工作