How to get sharepoint site group name using Graph API?

Andrea Quarta 30 Reputation points
2024-10-16T08:58:06.5666667+00:00

34286-sitegroups.png

SharePoint has other groups of users that are listed in Settings > Site Permissions. In that we have list of Owners, Members, Visitors). Is there any way we can fetch these groups using graph Api.

how can i extract sharepoint groups and relative members from a site ?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,140 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
3,013 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Hitesh Pachipulusu - MSFT 2,300 Reputation points Microsoft Vendor
    2024-10-16T10:23:05.6533333+00:00

    Hello Andrea Quarta,

    Thank you for contacting Microsoft Support!

    Upon reviewing the Microsoft Graph API documentation, it appears that there isn’t a specific endpoint available to retrieve SharePoint Group Owners, members or their visitors at this time. However, if your goal is to obtain a comprehensive list of users and groups associated with a SharePoint site, you may perform a query on the “User Information List” as follows:

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

    Hope this helps.

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


  2. Emily Du-MSFT 46,956 Reputation points Microsoft Vendor
    2024-10-17T08:29:06.5333333+00:00

    As Hitesh Pachipulusu said, there is no Graph API to retrieve SharePoint groups.

    You could use Graph API GET https://graph.microsoft.com/v1.0/sites/{siteid}/lists/User Information List/items?expand=fields to list users and groups in the user information list.

    Note: Only site collection administrator can access user information list. Make sure you are site collection administrator then run Graph API.

    In another way, you could use PowerShell to get all SharePoint groups.

    https://www.sharepointdiary.com/2018/03/sharepoint-online-get-groups-using-powershell.html

    Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.


    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 Answers by the question author, which helps users to know the answer solved the author's problem.