Delete Sharepoint group using Jsom
function DeleteWebGroup(GRPtitle) {
var clientContext = new SP.ClientContext.get_current();
var collGroup = clientContext.get_web().get_siteGroups();
oGroup = collGroup.getByName(GRPtitle);
collGroup.remove(oGroup);
clientContext.executeQueryAsync(Function.createDelegate(this, this.onSetQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));}
function onSetQuerySucceeded() {
alert("Group deleted.");
}
function onQueryFailed(sender, args) {
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}
var oGroup;
DeleteWebGroup("test");
No comments:
Post a Comment