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 Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,337 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,222 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Emily Du-MSFT 43,836 Reputation points Microsoft Vendor
    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.