This project has moved and is read-only. For the latest updates, please go here.

Updatelist example

Jan 13, 2011 at 8: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 2: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 3: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: