Hi i'm trying to create a sharepoint list with SPServices and I've got the create part working.
next i need to add new columns either during the creation or after. However I cant get the add new fileds to work.
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);
}
});
i'm getting a 200 code back from the alert(xData.status); which as far as i'm awere is a sucssess code but when i look at the list it is not there.
$().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);
}
});
I fixed it now works fine
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.