Do you need to get a list of all the members of a group in your flow?
Groups are at the core of security and access in a Microsoft 365 tenant. For example, you could use a group to manage an approval process.
Membership in the group could grant the members access to the correct files as well as be used to send approval requests to the correct users. This way you only need to maintain the group membership to manage the process.
Then you can list the group members within your flow to email, notify, or send approvals to the correct users.
This post will explore how to list both SharePoint group members and Microsoft 365 group members in your flows.
Get Group ID from Azure Active Directory
To list group members in Power Automate for groups you are not the owner of, you need to get the group ID.
This is because Power Automate will not show the group in the dropdown list unless you are an owner. You can ask the owner of the group or an IT admin for the ID.
It can be found in many places, but the easiest place will be the Azure Active Directory (Azure AD) portal. This will list all groups in the tenant.
- Go to the list of all groups in the Azure AD portal.
- You can find the correct group ID for your group in the Object id column.
Another option is to use the List groups action from the Office 365 Group connector. This will list all the groups in your tenant regardless of ownership or membership.
Now that you have the group ID, you can use it as an input parameter in Power Automate’s List group members action. This way, you can list all the members of groups for which you are not the owner.
List Microsoft 365 Group Members
To list Microsoft 365 group members you’ll need the Office 365 Group connector. This connector offers the List group members action, which will enable you to list all members of a specific group.
Here’s how you can list all group members using the List group members action in the Office 365 Group connector.
- Add the List group members from the Office 365 Group connector.
- Use the Group Id dropdown list to select the group from which you want to list members. If your group is not listed, you can select the Enter custom value option and paste the group ID into the field.
The List group members action will return an array of group members, containing the user ID, display name, job title, and email, among other details that are populated in Azure AD.
You can process this information as per your requirements. For example, you can use the Apply to each loop action to iterate through the list of group members and perform subsequent operations, such as sending tailored emails or updating members’ profiles.
List SharePoint Group Members
If you need to list members in a SharePoint group, the process will be a bit different.
There is no SharePoint connector action to list group members, but you can use the Send an HTTP request to SharePoint action.
This action allows you to interact with the SharePoint REST API, which provides access to group membership information.
Here are the steps to retrieve members from a SharePoint group.
- Begin by adding the Send an HTTP request to SharePoint action to your flow.
- Choose the SharePoint Site Address that hosts the group you wish to contact.
- Choose GET as the Method to be used.
_api/web/siteGroups/getByName('Your SP Group Name')/users
- Enter the following path in the Uri field, replacing
Your SP Group Namewith the actual name of your group. Spaces are allowed in the name. This API endpoint will return all the users present in the group.
Now, your flow will send the HTTP request to SharePoint, and the response will contain JSON with the group members. To parse the JSON data, add a Parse JSON action after the Send an HTTP request to SharePoint action.
In the Content field, set it to the Body property from the Send an HTTP request to SharePoint action. For the schema, you can use the Generate from sample functionality using an example response from the SharePoint API.
Listing group members is essential for effectively targeting the correct audience in your workflow.
Utilizing the Office 365 Group connector, you can easily retrieve group members for your tasks. This might require that you provide the necessary group ID since only groups you own will show in the action user interface.
You can also list members in SharePoint groups, but the process will require the Send an HTTP request to SharePoint action.
Were you able to list your group members from Microsoft 365 groups or SharePoint groups? How did you do this? Let me know in the comments!