When are calling rest API = _api/web/sitegroups
output =
<content type="application/xml">
<m:properties>
<d:Id m:type="Edm.Int32">5</d:Id>
<d:IsHiddenInUI m:type="Edm.Boolean">false</d:IsHiddenInUI>
<d:LoginName>QA_Automation2 Members</d:LoginName>
<d:Title>QA_Automation2 Members</d:Title>
<d:PrincipalType m:type="Edm.Int32">8</d:PrincipalType>
<d:AllowMembersEditMembership m:type="Edm.Boolean">true</d:AllowMembersEditMembership>
<d:AllowRequestToJoinLeave m:type="Edm.Boolean">false</d:AllowRequestToJoinLeave>
<d:AutoAcceptRequestToJoinLeave m:type="Edm.Boolean">false</d:AutoAcceptRequestToJoinLeave>
<d:Description m:null="true" />
<d:OnlyAllowMembersViewMembership m:type="Edm.Boolean">false</d:OnlyAllowMembersViewMembership>
<d:OwnerTitle>QA_Automation2 Owners</d:OwnerTitle>
<d:RequestToJoinLeaveEmailSetting></d:RequestToJoinLeaveEmailSetting>
</m:properties>
</content>
<content type="application/xml">
<m:properties>
<d:Id m:type="Edm.Int32">3</d:Id>
<d:IsHiddenInUI m:type="Edm.Boolean">false</d:IsHiddenInUI>
<d:LoginName>QA_Automation2 Owners</d:LoginName>
<d:Title>QA_Automation2 Owners</d:Title>
<d:PrincipalType m:type="Edm.Int32">8</d:PrincipalType>
<d:AllowMembersEditMembership m:type="Edm.Boolean">false</d:AllowMembersEditMembership>
<d:AllowRequestToJoinLeave m:type="Edm.Boolean">false</d:AllowRequestToJoinLeave>
<d:AutoAcceptRequestToJoinLeave m:type="Edm.Boolean">false</d:AutoAcceptRequestToJoinLeave>
<d:Description m:null="true" />
<d:OnlyAllowMembersViewMembership m:type="Edm.Boolean">false</d:OnlyAllowMembersViewMembership>
<d:OwnerTitle>QA_Automation2 Owners</d:OwnerTitle>
<d:RequestToJoinLeaveEmailSetting></d:RequestToJoinLeaveEmailSetting>
</m:properties>
</content>
<content type="application/xml">
<m:properties>
<d:Id m:type="Edm.Int32">4</d:Id>
<d:IsHiddenInUI m:type="Edm.Boolean">false</d:IsHiddenInUI>
<d:LoginName>QA_Automation2 Visitors</d:LoginName>
<d:Title>QA_Automation2 Visitors</d:Title>
<d:PrincipalType m:type="Edm.Int32">8</d:PrincipalType>
<d:AllowMembersEditMembership m:type="Edm.Boolean">false</d:AllowMembersEditMembership>
<d:AllowRequestToJoinLeave m:type="Edm.Boolean">false</d:AllowRequestToJoinLeave>
<d:AutoAcceptRequestToJoinLeave m:type="Edm.Boolean">false</d:AutoAcceptRequestToJoinLeave>
<d:Description m:null="true" />
<d:OnlyAllowMembersViewMembership m:type="Edm.Boolean">false</d:OnlyAllowMembersViewMembership>
<d:OwnerTitle>QA_Automation2 Owners</d:OwnerTitle>
<d:RequestToJoinLeaveEmailSetting></d:RequestToJoinLeaveEmailSetting>
</m:properties>
</content>
<content type="application/xml">
<m:properties>
<d:Id m:type="Edm.Int32">19</d:Id>
<d:IsHiddenInUI m:type="Edm.Boolean">false</d:IsHiddenInUI>
<d:LoginName>SharingLinks.040a2b23-abff-4089-ad97-53272ef5c988.Flexible.05b1bf35-5712-422a-a4d4-023cb4951c48</d:LoginName>
<d:Title>SharingLinks.040a2b23-abff-4089-ad97-53272ef5c988.Flexible.05b1bf35-5712-422a-a4d4-023cb4951c48</d:Title>
<d:PrincipalType m:type="Edm.Int32">8</d:PrincipalType>
<d:AllowMembersEditMembership m:type="Edm.Boolean">false</d:AllowMembersEditMembership>
<d:AllowRequestToJoinLeave m:type="Edm.Boolean">false</d:AllowRequestToJoinLeave>
<d:AutoAcceptRequestToJoinLeave m:type="Edm.Boolean">false</d:AutoAcceptRequestToJoinLeave>
<d:Description>This group is for Flexible sharing links on item 'DocumentLibrary_2021_03_11_10_20_00_911/newfold123_99'</d:Description>
<d:OnlyAllowMembersViewMembership m:type="Edm.Boolean">true</d:OnlyAllowMembersViewMembership>
<d:OwnerTitle>System Account</d:OwnerTitle>
<d:RequestToJoinLeaveEmailSetting m:null="true" />
</m:properties>
</content>
We are getting only 4 groups but
when we are checking groups through SP site,
it is showing different groups also (ACL Testing, can see in above screen shot )
but we are not getting this group in rest api call
Hi @Pankaj Kumar ,
You may misunderstand the SharePoint groups. The SharePoint groups are created in your SharePoint site (not in M365 or AAD). You could refer to this article to create a SharePoint group: https://learn.microsoft.com/en-us/sharepoint/customize-sharepoint-site-permissions
I think the ACL Testing group is M365 group , right? SharePoint groups is different from M365 groups. And M365 group is seen as a normal user in sharepoint and M365 groups can be added in SharePoint group.
The api call
/_api/web/sitegroups
would only get SharePoint groups. And the ACL Testing group is seen as a user in SharePoint site, you need to use the api call/_api/web/siteusers
to get it.Hi @Michael ,
is there any API which can give all group available that even not belong to a site?
Regards,
Pankaj Kumar
Hi @Pankaj Kumar ,
SharePoint Rest API cannot do this. You could use graph api to list all groups with this endpoint:
https://graph.microsoft.com/v1.0/groups
More details is here: https://learn.microsoft.com/en-us/graph/api/group-list?view=graph-rest-1.0&tabs=http
Sign in to comment