How to get Owner Group Name in SharePoint Group in Sharepoint 2013 using CSOM?

Hello Sharepointers,

In this blog, I will give you the piece of CSOM code to get the SharePoint group owner name.

function getGroupOwner (GroupName) {

var clientContext = new SP.ClientContext.get_current();

var web = clientContext.get_web();

var groups = web.get_groups();

var group = groups.getByName(GroupName);

var groupOwner = group.get_owner();

clientContext.load(web);

clientContext.executeQueryAsync( function() {

console.log(‘Success’);

var ownerLoginName = groupOwner.get_ownerTitle();

console.log(‘ownerLoginName: ‘ + ownerLoginName);

},

function (sender, args) {

console.log(‘Error: ‘ + args.get_message());

}

}

Happy Sharepointing Folks šŸ™‚

Leave a Reply

Your email address will not be published. Required fields are marked *