0

We have a Permissions groups of around 4k in our site collection. In the same site I have created a sub site and given the permissions up to 2k groups. Now when I try to get the groups data in the sub site I am getting all the 4K groups as they were in site collection level. I tried to filter them with permission level as we roledefid to know the permission of the group. But here when I try to get all the groups I am not getting roledefid property in the object. Is there any query to get roledefid to all the groups.

Code I used to get the groups:

    url = _spPageContextInfo.webAbsoluteUrl + "/_api/web/sitegroups";
$.ajax({
    url: url,
    method: "GET",
    async: async,
    headers: {
        "Accept": "application/json; odata=verbose"
    },
    success: function(data) {
        console.log(data);
    },
    error: OnError
});

Result i am getting with properties:

AllowMembersEditMembership: true
AllowRequestToJoinLeave: false
AutoAcceptRequestToJoinLeave: false
Description: ""
Id: 1977
IsHiddenInUI: false
LoginName: "GroupName"
OnlyAllowMembersViewMembership: false
Owner: {__deferred: {…}}
OwnerTitle: "GroupName"
PrincipalType: 8
RequestToJoinLeaveEmailSetting: null
Title: "GroupName"
Users: {__deferred: {…}}
__metadata: {id: "url", uri: "url", type: "SP.Group"}
__proto__: Object
0

You won't be able to get this from the Site Group object alone. Your rest-call only retrieves group information (title, id, description and other metadata).

To retrieve permission levels you will need to do a couple of more calls. See Users, groups, and roles REST API reference to read more about RoleAssignment and RoleDefinition.

0

You could try the below api call:

/_api/web/roleassignments?$expand=Member/users,RoleDefinitionBindings

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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