How to retrieve the SharePoint group IDs of the current user using Graph API

Patidar, Jaydeep 20 Reputation points
2024-06-20T13:54:30.73+00:00

What's the best way to retrieve the IDs of SharePoint groups in which the current user is a member using Graph API?

Microsoft 365 and Office | SharePoint | For business | Windows
Microsoft Security | Microsoft Graph
{count} votes

1 answer

Sort by: Most helpful
  1. Emily Du-MSFT 51,931 Reputation points Microsoft External Staff
    2024-06-21T03:10:30.9566667+00:00

    Per my research, there is no dedicated endpoint in Microsoft Graph to get SharePoint Group permissions and their members currently.

    You only could get the id of Microsoft 365 groups in which the current user is a member.

    Here are steps:

    1.Get the user id by using following graph query.

    https://graph.microsoft.com/v1.0/users?$filter=displayName eq 'DisplayName'
    

    2.Get the Microsoft 365 group display name and id by using following graph query.

    https://graph.microsoft.com/v1.0/users/{userid}/memberOf/microsoft.graph.group?$select=displayName,id
    

    1


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    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.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.