“There’s an action to list M365 group members, but what about the group owners, does Power Automate have an action to get them?”
Power Automate takes a different approach on M365 groups depending on user roles. You can easily work with members using designated actions, but there’s no action for owners. If you want to work with the owners, you must do that via the Graph API. That applies to all operations, let it be listing the owners, or removing them. But how do you call the Graph API?
Get the group ID first
Unless you know the M365 group ID, you’ll have to get it first as the call needs it. Get it by listing all the groups you own or belong to, and filter by the group name.
The outcome of the ‘Filter array’ will be just the single group, and its ID will be among the dynamic contents.
Send the request to Graph API
A full HTTP request is a premium action in Power Automate, but there’s another action that’s included in the free version. It’s called ‘Send an HTTP request’ and you can find it in the Office 365 Groups group of actions.
Add the action to your flow to send the HTTP request below.
Method: GET Uri: https://graph.microsoft.com/v1.0/groups/<groupID>/owners
Note: <…> is a placeholder, replace it including the < and > with the group ID.
Don’t worry about the ‘Apply to each’. If you use the output of the ‘Filter array’ it’ll contain only a single group = it’ll run only once.
Extract the owners
Since it’s an HTTP request, it’ll provide the output only as a whole JSON. It won’t parse it to dynamic contents for each of the returned values. But that’s no problem as you can extract the values from the JSON directly.
The owners will be stored in the ‘value’ array, so you can easily ‘Select’ the values you’re interested in. Use the array with the users as the input, and select the value, e.g. their email.
Input: body('Send_an_HTTP_request')?['value'] Map: item()?['email']
You’ll get an array with email addresses of the owners of this specific M365 group.
As in so many situations before, when there’s no dedicated action, the solution is an HTTP request. Get the group ID, ask Graph API for the owners, and then extract them from the result using ‘Select’ and expressions. You just used Power Automate to get the group owners and you can process them later in the flow.