I'm trying to update a field 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 does not allow messages larger than 2097152 bytes"
Is this normal as these items are small? See the code below. How can i turn the code below to update in batches?
function updateListItems() {
// Create an instance of the current context to return context information
clientContext = new SP.ClientContext.get_current();
var oList = clientContext.get_web().get_lists().getByTitle('Test');
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml('<View><Query></Query></View>');
this.collListItem = oList.getItems(camlQuery);
clientContext.load(oList);
clientContext.load(collListItem);
clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
}
function onQuerySucceeded() {
var listItemEnumerator = collListItem.getEnumerator();
while (listItemEnumerator.moveNext())
{
var item = listItemEnumerator.get_current();
item.set_item("TestUnit", "TestUnit");
//Commits changed properties of the list item
item.update();
}
clientContext.executeQueryAsync(Function.createDelegate(this, this.onUpdateSucceeded), Function.createDelegate(this, this.onQueryFailed));
}
Thanks in Advance