Using SPUpdateMultipleListItems error updating more than 200 items - Office 365 SharePoint Online

Jun 11, 2014 at 4:45 PM
I have a list that is 1600+. My requirement is to update a column in items that have changed recently. If my query returns more 400 items - it only updates 200 and returns an error of 'Request timed out'. The error comes at 120 - 130 seconds. Sometimes it doesn't process the update at all and returns 'Cannot access a closed stream'.
Jun 11, 2014 at 6:01 PM
This doesn't surprise me. The SPUpdateMultipleListItems function issues the updates as one large batch. When n is large, this can fail. I'd suggest cloning the function so that you can break out the requests into smaller chunks. The number of requests per batch that will work in your case may depend on the data you are sending and receiving back.

Jun 11, 2014 at 9:11 PM
Thanks, I will try the cloning - what are your thoughts on the code picking up in the next function from the last to make sure the entire query is executed - I am concerned about the reliability with this approach.
Jun 11, 2014 at 9:15 PM
You'll just want to break the requests down into smaller checks. For instance, just do ten update in each UpdateListItems. Right now it's trying to do all 200 at once.

Jun 12, 2014 at 12:07 AM
Take a look at this post:

I posted a function that already does this. You give it an unlimited amount of updates and the function returns you a promise that resolves when they are all done. Inside it executes the updates in batches (of 100 I think). There are input options to control different things.


Paul T.

-- Sent from Mobile

Marked as answer by GregRT on 6/12/2014 at 8:44 AM
Jun 12, 2014 at 12:44 PM
Thank you! That is exactly what I was thinking but lacked the skills to execute ... I am in your debt, sir! I am using your 'Black Magic' solution on a current project - it is a great example of code reuse and how to build a client side application.

Jun 12, 2014 at 3:08 PM
I've got to get Paul's great fix into the next version of SPServices!

Jun 12, 2014 at 3:44 PM
Where's the petition!
Jun 12, 2014 at 3:46 PM
Jun 12, 2014 at 3:57 PM
Thanks Greg... Glad I could help and awesome to know you worked with the solution from the book. :)
Mark: I'll pledge my support for the change (although its a bias one :) )

Paul T