0

I am trying to manipulate the members of a site in SharePoint using Graph API. I want to be able to get the members group of a specific Site using the site id. Then I want to be able to add/remove members in that group. I saw this website Adding members to a specific group but it does not tell me how to get the members group of a specific site. The problem is that it expects that you already have the id of the group you are adding/removing the members from and I do not have that id. If for example you have this site in SharePoint:

https://X.sharepoint.com/sites/MySite

then I would like to be able to get the Members group for it so I can get the ID of the group so I can use the provided link to add/remove members with Graph API.

Currently I am doing this successfully using the REST endpoints but I would like to move everything I can to use the Graph API instead and I am having a hard time figuring out how to do this using the Graph API.

Maybe I should point out that I am using version 4 of the Graph API.

7
  • Is your site connected with Office Group or not? Mar 17, 2023 at 9:15
  • Are you using team site connected with M365 group or communication site? You want to get M365 members group associated with SharePoint site? Link you provided in your question is related to security/M365 groups and not SharePoint groups. For security/M365 groups, you can get group using filter, check: learn.microsoft.com/en-us/graph/api/… Mar 17, 2023 at 9:15
  • Are you using team site connected with M365 group or communication site? Is your site connected with Office Group or not? Which version of SharePoint am I using? Here is the version I am using: "You are using SharePoint in Microsoft 365 Formerly known as "SharePoint Online," this is the subscription version of SharePoint that comes with Microsoft 365."
    – Sigmundur
    Mar 17, 2023 at 9:26
  • We understood that you are using SharePoint online. In SharePoint online we can create team sites or communication sites. which one are you using? Mar 17, 2023 at 10:56
  • I am using team sites.
    – Sigmundur
    Mar 17, 2023 at 12:15

1 Answer 1

1

You can use Microsoft Graph to manage Microsoft 365 group members.

enter image description here

But you cannot use Microsoft Graph to manage SharePoint group members.

enter image description here

SharePoint Online sites may be connected to a Microsoft 365 group. If they are, adding or removing users to/from the Microsoft 365 group will add or remove the user to/from the site. This can be done using Microsoft Graph.

SharePoint Online sites also use SharePoint groups. Adding or removing users to/from the SharePoint groups will add or remove the user to/from the site. This cannot be done using Microsoft Graph.

I hope this helps.

2
  • That might explain why I am having such a hard time finding information about this. Could I create a Microsoft 365 group, add all the members that I want to it, and then attach it to the Members of the site I just created?
    – Sigmundur
    Mar 17, 2023 at 12:34
  • See Connect to a Microsoft 365 group (learn.microsoft.com/en-us/sharepoint/dev/transform/…) for information on how to connect a Microsoft 365 group to an existing SharePoint site. Mar 17, 2023 at 12:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.