List Aggregator App (SPFx)

Delete a list item using JavaScript object model in SharePoint 2013

In this post we will discuss about how to delete a list item using JavaScript object model in SharePoint 2013. Also you can check out my previous posts on:

– Tutorial on Create SharePoint 2010 designer workflow

SharePoint deveopment training course

– SPMetal in SharePoint 2010

function deleteListItem(siteUrl) {

this.itemId = 1;

var clientContext = new SP.ClientContext(siteUrl);

var list = clientContext.get_web().get_lists().getByTitle(‘MyCustomList’);

this.listItem = list.getItemById(itemId);

listItem.deleteObject();

clientContext.executeQueryAsync(
Function.createDelegate(this, this.onQuerySucceeded),

Function.createDelegate(this, this.onQueryFailed)
);
}

function onQuerySucceeded() {
alert(‘Item deleted: ‘ + itemId);
}


function onQueryFailed(sender, args) {
alert(‘Could not able to delete item: ‘ + args.get_message());
}

Hope this will be helpful.

Check out Best Alternative to InfoPath -> Try Now

free sharepoint training

SharePoint Online FREE Training

JOIN a FREE SharePoint Video Course (3 Part Video Series)

envelope
envelope

About Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SharePointSky.com

View all posts by Bijay Kumar →