Delete SharePoint List or Document Library.
var Title = "TestsDelete";
function deleteList(Title) {
var clientContext = new SP.ClientContext.get_current();
var oWebsite = clientContext.get_web();
this.oList = oWebsite.get_lists().getByTitle(Title);
oList.deleteObject();
clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
}
function onQuerySucceeded() {
alert(Title + ' deleted.';);
}
function onQueryFailed(sender, args) {
alert('Request failed. ' + args.get_message() );
}
deleteList(Title ) ;
No comments:
Post a Comment