Getting SharePoint Modern Team Site Office 365 Groups Owners And Members Through Power Automate

When creating a modern team site, it will connect to Microsoft 365 group. This gives your site a shared notebook, group email address, and team calendar. Moreover, it allows owners to add members directly in the main home page, which basically adds users in the Office 365 group associated with the site.  

So, how do you retrieve Owners and Members specifically in the SharePoint Team's group site using Power Automate?

  • Before creating power automate, we need a group email address. Based on that, we will find the group ID. This is required to use Graph API, which we will use later. 
  • Let's create an instant power automate with a manual trigger, but before that, we need a Group email ID. There are multiple ways to find one, as shown below:


     
  • Click on Add members as shown in above screenshots. Then go to Outlook. It will open the group, so from there you can copy the email address.
  • The second way is to get this is from Sharepoint groups, then Members. Click on the group email address.

  • You can also get an email address through Rest API by querying out the Owner Group. 
  • Once you have an email address, open your flow. After selecting manually trigger point, initialize a variable to store the email address. Then, initialize a group to store owners/members. 
  • Now, create an operation called "Send an HTTP Request" (here the connector is Office 365 groups). Here we need to identify the group ID of the email. 


URI : https://graph.microsoft.com/v1.0/groups/?$filter=mail eq  '@{variables('GroupEmail')}'

Parse output in JSON of the above request in this format:

{
    "type": "object",
    "properties": {
        "@@odata.context": {
            "type": "string"
        },
        "value": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string"
                    },
                    "mail": {
                        "type": "string"
                    }
                },
                "required": ["id", "mail"]
            }
        }
    }
}

Create another "Send an HTTP Request". This is where we need to retrieve lists of owners or members. In our case, we are retrieving owners. 

  • Here the URL you can use to retrieve the owners: https://graph.microsoft.com/v1.0/groups/@{items('Apply_to_each')?['id']}/owners
  • Once that is done, we will parse it in JSON and get the response of owners email id, group name, and display name. Append to your group array for each iteration.
  • After iteration, in compose it will show the output.

Result:

Attachment ZIP Added

I have attached the power Automate zip for reference.

Thanks!