How can I quickly export a list of all members in a specific Team? As a Microsoft Team’s owner you have probably come to the conclusion that managing your Team membership is not easy.
This blog is a two part blog. Read part one to see how you can use Power Automate to bulk add new members into a Microsoft Team.
Part two of the blog now explains how you can use Power Automate to automatically export a list of members from a Team into an Excel spreadsheet. With the added bonus of including several user attributes such as job title, mobile or office along side their name and email.
This Power Automate will create a Flow that will request the owner to enter the Team name of the Team they they want a membership list of. The flow will then extract the members plus any particular user attributes into a spreadsheet.
Step 1 Create Excel spreadsheet
Create an Excel spreadsheet that will contain list the exported members.
Create one or more columns for the user attributes you want to export. The table below shows the attributes available to export.
Highlight the column names and select Format as Table you data as a table. Make sure you also tick that your My Table has headers.
Save the Excel file in OneDrive or SharePoint.
Create Power Automate flow to export the members to the Excel spreadsheet
Create a new Instant cloud trigger flow – using the Manually trigger a flow.
Select +Add an input and add a text input so you can add your Team name.
Get your Group/ Team id
We now need to get the Team id so that we can get a list of members in the Team. For these actions we need to use the Microsoft 365 Group actions rather than the Team actions.
Add a List my owned Groups action. This will return a list of all the Groups (including Teams) that you are an owner of.
Add a Condition step. With the condition if Group Name in the List my owned Groups equals the Team name entered.
This will automatically apply the Apply to Each step so that it can look though each Group (including Teams) name to see if it is equal to the Team name entered.
List all Group/Team members
Under the Yes step (if a match has been found).
Add a List Group members action.
Add in the Group id of the List my groups. This will be the Group id for the Team name you you entered at the start of the flow.
This will generate a list of the Group members. Note there is a limitation of 1000 users returned.
Export members to the spreadsheet
Add an Excel Add row into table step. This will automatically add the Apply to each step as you want the action to apply to each member of the Team.
Select the location, Document Library and file for the file created at the beginning of this process.
Select the Table (normally Table1 unless you have renamed it). If you do not see the table name then you need to go back to the spreadsheet and create a table in the spreadsheet to hold the data.
The map the dynamic variables from the List Group members to the column in your spreadsheet. In the example below I created columns in the spreadsheet for Display name and email.
Save your flow with an appropriate name
Run the Power Automate flow
When you run the flow you need to enter the Team name of the Team you want a membership list of.
If the name entered does not match the Team display name the Flow will not export any results. To minimize issues copy the Team name and paste into the Flow input box.
If the flow is successful the list of members will be added to the spreadsheet you created.
Read part one of this blog to see how you can use Power Automate to bulk add new members into a Microsoft Team.