Function

$().SPServices

Web Service

Lists

Supported Operations

Operation Options MSDN Documentation Introduced
AddList [webURL], listName, description, templateID Lists.AddList Method 0.2.9
DeleteList [webURL], listName Lists.DeleteList Method 0.2.9
GetList [webURL], listName Lists.GetList Method 0.2.3
GetListAndView [webURL], listName, viewName Lists.GetListAndView Method 0.2.9
GetAttachmentCollection [webURL], listName, ID Lists.GetAttachmentCollection Method 0.2.6
GetListCollection [webURL] Lists.GetListCollection Method 0.2.3
GetListItems [webURL], listName, CAMLViewFields, CAMLQuery, CAMLRowLimit, CAMLQueryOptions Lists.GetListItems Method 0.2.3
UpdateListItems [1] [webURL], listName, updates, [batchCmd, valuepairs, ID] Lists.UpdateListItems Method 0.2.3



[1] UpdateListItems
If you want to update a single list item, rather than using the CAML syntax in updates you can specify valuepairs and the item's ID. If you specify valuepairs then updates is ignored. The way it works is that it lets you specify an array of column StaticNames and values. So if you wanted to update the Title and the Body:

valuepairs: [["Title", "New Title Value"], ["Body", "Here is a the new text for the body column."]]

All that happens here is that the valuepairs are used to build up the CAML for UpdateListItems rather than requiring you to specify the full CAML syntax, which in this case would be:

<Batch OnError='Continue'>
  <Method ID='1' Cmd='Update'>
    <Field Name='Title'>New Title Value</Field>
    <Field Name='Body'>Here is a the new text for the body column.</Field>
    <Field Name='ID'>1234</Field>";
  </Method>
</Batch>
Note that if you decide to use the valuepairs approach, you also need to specify the ID option. The default for the batchCmd option is 'Update'.
Last edited Tue at 2:23 PM by sympmarc, version 3
Comments
No comments yet.

Updating...
© 2006-2009 Microsoft | About CodePlex | Privacy Statement | Terms of Use | Code of Conduct | Advertise With Us | Version 2009.10.27.15987