SharePoint list item update using CSOM
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 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'); | |
} | |
); | |
} |