I have root site and it has many subsites. I have to get Site owners of each subsite using CMOS. I have writtern below code but its not giving owner's detials instead its giving all site group information.

 var ctx = new SP.ClientContext("<subsite url>");
        var web = ctx.get_web();
        var groupCollection = web.get_siteGroups();
        ctx.load(groupCollection, 'Include(Users,Title)');

Now, Once I get values in "groupCollection", I am looping into groups and then users. But I am getting all sharepoint group not specific to .

Please suggest where I am wrong.

1 Answer 1


You can make use of the get_associatedOwnerGroup() method to get the owner group members.

Modify your code from below sample:

var clientContext = new SP.ClientContext("<subsite url>");
var oGroup = clientContext.get_web().get_associatedOwnerGroup();
var collUser = oGroup.get_users();


    var userEnumerator = collUser.getEnumerator();
    while (userEnumerator.moveNext()) {
        var oUser = userEnumerator.get_current();
        //do stuff with user object

  • Thanks for reply. But its giving me Root site owners emails not <subsite url> owners email.
    – Prashant K
    Commented Mar 24, 2018 at 7:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.