I've searched the jQuery SPServices code examples and MSDN references for an simple example how to update several ListItems using a Where-Clause.

Code for updating a single ListItem with ID = 500, looks like this:

    operation: "UpdateListItems",
    listName: "MyList",
    ID: 500,
    valuepairs: [["MyField", 1]],
    completefunc: function (xData, Status) {

But is it also possible to add a Where like :

<Where><Eq><FieldRef Name="Status"/><Value Type="Text">Ready</Value></Eq></Where>

Or should I do it like this post ? (First retrieve the list and then do a loop for each item ?)

6 Answers 6


there. If you are using jQuery and the Web Services (hopefully with my SPServices library!), you have to do the two step process. Call GetListItems with your CAMLQuery first to get the items you need to work with and then call UpdateListItems to make the changes.

This isn't my design, by the way, it's just the way the SharePoint Lists Web Service works. When in doubt, always go to the source documentation on MSDN to see what each operation requires for parameters. I have links on all of the operations in SPServices which take you directly to the appropriate page on MSDN.

Finally, the Batch idea in UpdateListItems is a little bit misleading in its terminology. You can, in fact, "batch" requests into one UpdateListItems call, but you may or may not want to do that based on what your error handling requirements are. Again, best to check the SDK on MSDN.

EDIT: I added a new function to SPServices in v0.5.8 called SPUpdateMultipleListItems to do this: http://spservices.codeplex.com/wikipage?title=%24%28%29.SPServices.SPUpdateMultipleListItems

  • Marc D Anderson, SPUpdateMultipleListItems have any limit? When my query returns 100 items, everything runs ok, but when my query return 700+ items I'm getting error and zero items are updated.
    – Joao Paulo
    May 23, 2018 at 17:33
  • 1
    There’s no specific limit; it’s more constrained based on the payload sizes. You may need to break your updates into chunks. I usually tried to stick to fewer than 100 items, but YMMV. May 23, 2018 at 21:54

I havent tried doing this specifically on jQuery, but you can for updating multiple list items using a batch update.

You use CAML to create batch commands and execute the command using ProcessBatchData method on SPWeb object.

Theres a good code sample on doing this on MSDN http://msdn.microsoft.com/en-us/library/cc404818.aspx

  • I only want to use clientside jQuery and SPServices, so your solution is good, but not feasible for me. Feb 22, 2010 at 14:11
  • fair enough, you will have to wait until Marc is back from vacation :-) Feb 22, 2010 at 21:52

His library does support a batch update, but I am not yet sure if the batch update supports a CAML query. If you are going to update multiple items, you could use the GetItems service with a CAML query to retrieve the items you want to update. You could then use the jQuery each on the return to then create an updateitems function for each item you want to update. Again, this is only feasible if you can't use a CAML query on a batch update.


I don't think it is available wihtout a Batch update.


I believe you'd have to query the list with your CAML query, then iterate through the results with your updates. That said, I did engage Marc to see if he can get you a formal answer on this.


SharePoint doesn't appear to natively support updating items based on a query at all, even using SPWeb.ProcessBatchData(). Quite a limitation, given the performance of trying to update each item by ID (even if it's with one big batch statement).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.