Skip to content

Instantly share code, notes, and snippets.

@vman
Last active December 19, 2015 18:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vman/6002083 to your computer and use it in GitHub Desktop.
Save vman/6002083 to your computer and use it in GitHub Desktop.
function updateListItems() {
var itemArray = [];
var clientContext = SP.ClientContext.get_current();
var oList = clientContext.get_web().get_lists().getByTitle('TestList');
for(var i = 1; i<= 5; i++){
var oListItem = oList.getItemById(i);
oListItem.set_item('Title', 'My Updated Item!' + i);
oListItem.update();
itemArray[i] = oListItem;
clientContext.load(itemArray[i]);
}
clientContext.executeQueryAsync(onQuerySucceeded, onQueryFailed);
}
function onQuerySucceeded() {
alert('Items Updated');
}
function onQueryFailed(sender, args) {
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}
updateListItems();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment