Get Group ID by SharePoint Site Url
SharePoint Online Team sites can have Microsoft 365 Groups associated with them. In this article I will show you how you can retrieve the Group ID of the related Microsoft 365 Group in a Power Automate flow.
Inspiration
This question from owidiuz:
How do i get the GroupID of an SP site owned by a group. I’m mentioning that I can’t go to Site collection-> Site Settings->People and Group, because it doesn’t appear to me. Is there another way to get the ID , like from flow. i can see that the “List group members” is asking for the groupid and I can find it in the dropdown, but I need to use that ID in another Step.
Power Users Community thread: Get the groupID for from sharepoint group
Interface
In the interface you could find this Group Id in at least a couple of different places.
Option A. Go the Planner Plan of the related group. The GroupId should be in the address bar.
Option B. In the Microsoft Admin Center go to Teams & groups > Active teams & groups > Find your group and click on the Name. The GroupId should be in the address bar.
However, we want to dynamically retrieve the Group Id value.
Allproperties method
You could use the allproperties method from the REST API to retrieve the Group ID value. JanardhanaVedham-MSFT has written a nice forum post on Microsoft Q&A about this option.
With a $select query parameter and the GroupId property this is a great way of retrieving the Id value. We can use that in a Send an HTTP request to SharePoint action.
Flow setup
1. Add a Manually trigger a flow action.
2. Add a Send an HTTP request to SharePoint action.
a. Select your preferred site in the Site Address, this would be the site from which you want to retrieve the Group Id value.
b. Use the GET method
c. Use the URI from the code snippet below
d. Use the Headers from the code snippet below
3. List group members.
a. Use the expression from the code snippet below as a custom value for the Group Id field
That is it for the setup of this example.
Happy testing!
Just wanted to say I love you! I spent a full day on this and your solution was exactly what I needed!
Hi Athena,
Great to hear this solution was useful for you, appreciate your feedback.