Forum Discussion
Patrick Rote
Oct 10, 2018Iron Contributor
Batch Update list items In SharePoint List Using JSOM/CSOM
Hi All, I'm trying to update multiple fields using CSOM. It works for few items but when i try t on items over 700 items i'm getting the error below:- the request message is too big. The server do...
Patrick Rote
Nov 23, 2018Iron Contributor
Hi again,
I'm not sure what changed . setting the timeout to infinite worked .But now it doesn't work any more. :(
See my code below. How can i batch update the items and calling executeQueryAsync each time. This is where i need help with.
Thanks in Advance
function updateMultipleListItems()
{
var itemArray = [];
var clientContext = SP.ClientContext.get_current();
//Stop it from timing out (infinite) but doesn't work
clientContext.RequestTimeout = -1;
var oList = clientContext.get_web().get_lists().getByTitle('bers');
while(ListItemToBeUpdated.moveNext())
{
var oItem = ListItemToBeUpdated.get_current();
var oListItem = oList.getItemById(oItem.get_id());
console.log(oListItem);
console.log(oItem.get_id());
oListItem.set_item('UpdateField', 'Update');
oListItem.update();
console..log("updated yes");
itemArray.push(oListItem);
clientContext.load(itemArray[itemArray.length-1]);
}
clientContext.executeQueryAsync(updateMultipleListItemsSuccess, updateMultipleListItemsFailed);
}
Patrick Rote
Nov 25, 2018Iron Contributor
No replies from anyone