question

DnyaneshwarSurywanshi-0008 avatar image
0 Votes"
DnyaneshwarSurywanshi-0008 asked DnyaneshwarSurywanshi-0008 edited

How to get sharepoint site group name using Graph API?

34286-sitegroups.png




I want to get all group name using graph API ?

office-sharepoint-onlineoffice-sharepoint-server-administrationoffice-sharepoint-server-developmentoffice-sharepoint-server-customization
sitegroups.png (91.3 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

BakerKong-MSFT avatar image
1 Vote"
BakerKong-MSFT answered DnyaneshwarSurywanshi-0008 edited

Hi @DnyaneshwarSurywanshi-0008,

By default, MS Graph API has not exposed such endpoints to access SharePoint site groups. But you can consider using below alternative method:

There is a hidden list "User Information List" that stores users (including groups) information. We can get group name through this list.

34389-1.jpg


The endpoint is:

 https://graph.microsoft.com/v1.0/sites/{siteid}/lists/User Information List/items?expand=fields

Reference doc:

Best Regards,
Baker Kong


If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


1.jpg (253.6 KiB)
· 6
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.


@BakerKong-MSFT

var data = await _client.Sites[site.Id].Lists["User Information List"].Items.Request().GetAsync();

Can you help me on C# side code to achive this right now i am using above code.

0 Votes 0 ·
BakerKong-MSFT avatar image BakerKong-MSFT DnyaneshwarSurywanshi-0008 ·
1 Vote 1 ·
image.png (25.1 KiB)

Thank You very much @BakerKong-MSFT

0 Votes 0 ·

I am using Angular 8 for front end and getting below error :

System.NotSupportedException: The collection type 'Microsoft.Graph.IListItemVersionsCollectionPage' on 'Microsoft.Graph.ListItem.Versions is not supported .

Can you please help me on this?

0 Votes 0 ·
Show more comments
sharatha avatar image
0 Votes"
sharatha answered

As of now, it does not appear that you can get SharePoint Groups using Graph API. Post your comment in user invoice.

https://microsoftgraph.uservoice.com/forums/920506-microsoft-graph-feature-requests/suggestions/35989975-get-sharepoint-security-groups-members-using-micro

You can use Rest API to get all SharePoint Groups in the Site, below is the example:

var requestUri = _spPageContextInfo.webAbsoluteUrl + "/_api/web/sitegroups

Thanks & Regards,

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.