Last active
December 19, 2015 18:58
-
-
Save vman/6002083 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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