Delete list item using JSOM :
Delete Folder Also uisng same code.
function deleteListItem() { this.itemId = 2; var clientContext = new SP.ClientContext.get_current();; var oList = clientContext.get_web().get_lists().getByTitle('ListTitle'); this.oListItem = oList.getItemById(itemId); oListItem.deleteObject(); clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded),
Function.createDelegate(this, this.onQueryFailed));
}
function onQuerySucceeded() {
alert('Item deleted: ' + itemId);
}
function onQueryFailed(sender, args) {
alert('Request failed. ' + args.get_message() );
}
No comments:
Post a Comment