In this blog, we are going to learn, how to delete SharePoint List item using JSOM/JavaScript.
We are going to delete the list item from the SharePoint list using the ID.
var clientContext = new SP.ClientContext("URL of your sharepoint tenant"); var oList = clientContext.get_web().get_lists().getByTitle('Title list '); oListItem = oList.getItemById(1)); oListItem.deleteObject(); clientContext.executeQueryAsync(Function.createDelegate(this, this.onQueryDelete), Function.createDelegate(this, this.onQueryFailed))
after successful execution of the function, it calls the onQueryDelete function and when it get failed it throws an exception.
Happy Coding!!!!!
We are going to delete the list item from the SharePoint list using the ID.
var clientContext = new SP.ClientContext("URL of your sharepoint tenant"); var oList = clientContext.get_web().get_lists().getByTitle('Title list '); oListItem = oList.getItemById(1)); oListItem.deleteObject(); clientContext.executeQueryAsync(Function.createDelegate(this, this.onQueryDelete), Function.createDelegate(this, this.onQueryFailed))
after successful execution of the function, it calls the onQueryDelete function and when it get failed it throws an exception.
Happy Coding!!!!!
Comments
Post a Comment