Hi All,
I'm currently getting this error below when i try and update more than 800 records at once
the request message is too big. The server does not allow messages larger than 2097152I
I need help with batching the request in 100 or more to help eliminate the error.
See my snippet below
Thanks in Advancefunction updateListItems() { var itemArray = []; var clientContext = SP.ClientContext.get_current(); var oList = clientContext.get_web().get_lists().getByTitle('List'); var camlQuery = new SP.CamlQuery(); camlQuery.set_viewXml('<View><Query></Query><RowLimit>200</RowLimit></View>'); this.collListItem = oList.getItems(camlQuery); clientContext.load(oList); clientContext.load(collListItem); /* If i pass individual id it works fine but i want to send batches of 100 here so it would update 100 items twice this.oListItem = oList.getItemById(11); oListItem.set_item("column", "textToUpdate"); oListItem.update(); clientContext.executeQueryAsync(onQuerySucceeded, onQueryFailed); /* here i need to loop though the itemid instead of looping though a whole sequence number for(var i = 0; i <= 1000; i++) { var oListItem = oList.getItemById(i); oListItem.set_item("column", "textToUpdate"); oListItem.update(); itemArray[i] = oListItem; clientContext.load(itemArray[i]); } */ } function onQuerySucceeded() { /* I can get a count here and item ids.
var count = 0; count = collListItem.get_count(); alert(count); var listItemInfo = ''; var listItemEnumerator = collListItem.getEnumerator(); while (listItemEnumerator.moveNext()) { var oListItem = listItemEnumerator.get_current(); listItemInfo += '\nID: ' + oListItem.get_id(); } alert(listItemInfo.toString()); } function onQueryFailed(sender, args) { alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace()); }