This project has moved. For the latest updates, please go here.

Updatelist example

Jan 13, 2011 at 7:19 PM

Can someone show an example using UpdateList.  I'm attempting to add a new field to a list and cannot figure out the format.


var newfield = "<Field Type='Text' DisplayName='New Test Field' Required='TRUE' FromBaseType='TRUE' MaxLength='255' Description='Description of new field' />"

		operation: "UpdateList",
		listName: FindListID("Test List"),
		async: false,
		newFields: newfield,
		completefunc: function (xData, Status) {

Jan 14, 2011 at 1:10 PM

After alot of testing I managed to figure this one out.  This will add the field to the list and the default view.


"<Fields><Method ID='1' AddToView=''><Field Type='Text' DateOnly='TRUE' DisplayName='TESTText' FromBaseType='TRUE'/></Method></Fields>"
Jan 14, 2011 at 2:36 PM

Glad you worked this out, and sorry I didn't answer faster.

As crappy as the documentation for the Web Services sometimes is, it's always the best first place to look. In the SPServices documentation, I have links for every Web Service and operation to the corresponding documentation page on MSDN in the SDK. In this particular case, you needed this page: