Thursday, 31 July 2014

sharepoint list item update programmatically CSOM

SharePoint list item update using CSOM

function updateListItem(listName, id,title) {
var ctx = new SP.ClientContext();
var oList = ctx.get_web().get_lists().getByTitle(listName);
var olistItem = oList.getItemById(id);
olistItem.set_item("Title", title);
olistItem.update();
ctx.load(olistItem);
ctx.executeQueryAsync(
function () {
console.log('updated success');
},
function (sender, args) {
console.log('Error in updating data');
}
);
}
view raw gistfile1.js hosted with ❤ by GitHub