Use Power Automate to bulk add members into Microsoft Teams

How can I add many members into my Microsoft Teams quickly and easily? As a Microsoft Team’s owner then you have probably come to the conclusion that managing your Team membership is not easy.

This blog explains how you can use Power Automate to automatically bulk add members into any Microsoft Team that you own.

I will walk through four scenarios

  1. Automatically add members to a Team using email addresses.
  2. Automatically add members to a Team using their display names.
  3. Automatically add a list of managers to a Team as owners and their direct reports as members.
  4. Create a data entry field in the Power Automate flow to allow the owner to choose which Team to import the users into.

Read part two of the blog to see how you can use Power Automate to export members of a Team into an Excel spreadsheet.

Scenarios

This blog describes how to use Power Automate to automatically add users from a spreadsheet as members of a specific Team.

I will start with two basic scenarios:

  1. Bulk add members using a spreadsheet that contains a list of user email addresses.
  2. Bulk add members using a spreadsheet that contains a list of user display names.

I will then show how you can extend the flow to solve two more complex scenarios:

  1. Bulk add a spreadsheet of manager email addresses as Team owners and their direct reports as members.
  2. Add a data entry field to allow the owner to choose which Team to import the users into.

Important. These Power Automate flows will only work is you are the owner of a Team.

Step 1 Create a table in a Excel sheet with your list of email addresses to be added to the team

Create an Excel sheet.

Add the list of user email addresses to be added to the Team. In the top cell call the column Names.

Top tips:

  1. Check the spelling of the email address
  2. Make sure that there are no extra spaces after the email address. A correctly formatted email will show as a link in the spreadsheet.

Highlight all the email addresses and the column title and select Format as Table.

Make sure you tick the box my table has headers.

Save in your OneDrive or SharePoint Online site.

Step 2 Create an Instant Power Automate Flow

Create a new Instant cloud trigger flow – using the Manually trigger a flow

Add action – Add rows present in a table

  • Location, Document Library and File – select where the Excel file called New users in London Team is stored in your OneDrive or SharePoint site
  • Table – select the table that you created in your Excel file.

Add action – Add member to a Team and select your Team.

Select the Team that you want to add the members to.

In the A user AAD ID for the user to add to a Team select the dynamic content and select Names from the Excel sheet.

As there could be multiple values in this column the Power Automate flow will add the Apply to each step. This will allow the flow to add each email address to the Team.

Add an appropriate file name e.g. Add users to London Team and select Save

Step 3 Run Flow

Make sure you have closed your Excel file.

The turn on your Flow and select Run.

Check that the Flow shows as successful. Your members have been added to the Team.

If the flow Failed then it is likely that one of the email addressees is invalid. Open up the flow to check.

But what if I don’t have their email addresses?

You can adapt the flow to use the person’s Display Name. Beware the user name may not be unique so the search could return multiple results. Therefore there is a risk that you could add the wrong person to a Team.

In the Excel file add in the user names rather than email addresses.

Update the flow to add in the additional actions to Search for the user to find their contact details.

Search string (applies to: display name, given name, surname, mail, mail nickname and user principal name). If not provided then no filtering will be applied.

See updated flow below.

I only have a list of managers. Can I add the managers and all their direct reports to a Team?

Yes this is possible too.

In the Excel sheet add in the managers’ email address. As mentioned before there is the risk of returning multiple results if there are duplicate names. Then the direct reports of the wrong manager would also be added to the Team. So I only recommend using this if you have the manager email addresses.

Add the managers to the Team as per previous steps. Optional: If you want to add the manager as owner of the Team – In the step to Add member to the Team select the Advanced options and select Yes to add the user as an owner of the Team.

Add an additional step under the Apply to each to Get direct reports for a user.

Then add a second Add a member to the Team action to add the direct reports to the team. Add the UPN from Get direct reports. This will automatically add an Apply this each step. This will loop through and add each direct report to the Team.

What if I need to repeat this process several times. Do I need to keep updating my Flow?

Let me show you how you can extend your flow to include an input field to allow you to enter the name of the Team you want add the members to.

As long as the Team name enters exactly matches a Team you are an owner of then the flow will add the users in the spreadsheet to that Team.

To get an input screen In the trigger add a +Add an input and a text field called Team name. this will be displayed when the user runs the flow.

Beneath the List rows present in a table add in a new action Add my owned groups.

This will return a list of all groups including Teams that you own.

Then add a Condition action to check If the Name in the group is equal to the Team name entered in the flow

Under the If yes box drag in Apply to each steps from you previous flow.

This will then add the members to the Team if the Team name entered matches one of the Teams you own.

Read part two of the blog to see how you can use Power Automate to export members of a Team into an Excel spreadsheet.

Keep Reading

PreviousNext

One thought on “Use Power Automate to bulk add members into Microsoft Teams

Comments are closed.