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
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.
This blog post is part of Microsoft Teams Week. Find more great blogs here.
About the Author:
Nikki Chapple is a Microsoft 365 Architecture Consultant who is passionate about Microsoft 365 and Teams
Nikki works as an Architecture Consultant for NTT Cloud Communications division of NTT Ltd and is an expert in Microsoft 365 and Teams.
She specialises in Microsoft Teams strategy, governance and adoption to ensure companies can collaborate securely in the cloud.
Working for a for a Microsoft Gold Partner Nikki has hands on experience helping multi-national customers on the analysis, design and delivery of their Microsoft Teams transformation projects.
Nikki is based in Hertfordshire in in the UK and has over 25 years experience in business transformations.
Chapple, N. (2021). Use Power Automate to bulk export members from Microsoft Teams. Available at: https://nikkichapple.com/use-power-automate-to-bulk-export-members-from-microsoft-teams/ [Accessed: 1st December 2021].