Contents

Add Teams Owners and Members with Power Automate OR Power Automate Desktop!

 

Today we’ll learn how we can add Microsoft Teams owners & members from a spreadhseet hosted in SharePoint using not only Power Automate (cloud) but also using Power Automate Desktop! Two posts for the price of one 😁

Common Artefacts

For both scenarios, we’ll use a spreadsheet called “New Joiners.xlsx” from SharePoint. This excel file contains 2 tabs:

  • PA –> data for our cloud flow
  • PAD –> data for our desktop flow
  • Both are transformed into a Table in the Excel file

/images/powerplatform-screenshots/teams-owners-members-power-automate-img1.png
/images/powerplatform-screenshots/teams-owners-members-power-automate-img2.png
 

Cloud Flow (Power Automate)

Ideally, you’d want to probably have a automated or scheduled trigger. But for the purpose this post, let’s create the flow with a Instant (manual) trigger.

Now, let’s look at the content of that spreadsheet with the List row present in a table action. We provide the information needed as to where the file is located, as well as the table name.

/images/powerplatform-screenshots/teams-owners-members-power-automate-img4.png

The last step is the Apply To Each with a Condition to add the user as an Owner or a Member. So we’ll have a true/false situation that can be go either way. As an example in my case, I’ve set the Member as the true branching, and the Owner as the false branching.
 

The action for Teams is to add the user as a Member, but then expand the Advanced parameters to select “Yes” when adding as an Owner 🙂

/images/powerplatform-screenshots/teams-owners-members-power-automate-img5.png
/images/powerplatform-screenshots/teams-owners-members-power-automate-img6.png

Running the flow, the branching should work as expected, and the users added in Teams!

/images/powerplatform-screenshots/teams-owners-members-power-automate-img7.png
/images/powerplatform-screenshots/teams-owners-members-power-automate-img8.png
 

Desktop Flow (Power Automate Desktop)

Time to switch to Power Automate Desktop (PAD). One main difference here is that, PAD doesn’t use triggers. We go straight into our first action, which is List row present in a table. the variable produced will be called %UsersResponse.value%.

/images/powerplatform-screenshots/teams-owners-members-power-automate-img9.png
 

And we follow the same pattern as the cloud flow, only the action names are different.

We insert a For each with an If/Else statement:

  • Variable name (output) of the For each will be called “CurrentUser”
  • Value to iterate will be %UsersResponse.value% (<– this is the variable name produced in our previous step)

Case Sensitive
Make sure to write Member with a capital M. This is case sensitive!.
 

/images/powerplatform-screenshots/teams-owners-members-power-automate-img13.png
/images/powerplatform-screenshots/teams-owners-members-power-automate-img10.png

Then, in our Add a team member action in the IF statement, we enter the TeamsGroupId and the UPN (both fields are from our Excel file). We also make sure that for this part of the branching (members), we don’t set the user to be an owner. This will be for the Else statement, just like in our cloud flow.

/images/powerplatform-screenshots/teams-owners-members-power-automate-img11.png
 

With regards to the ELSE statement, we do the same, but we set the Owners parameter to True.

/images/powerplatform-screenshots/teams-owners-members-power-automate-img12.png
 

The entire desktop flow will look like this:

/images/powerplatform-screenshots/teams-owners-members-power-automate-img14.png

  After running the flow, if everything went well, users are also added correctly!

  Thanks for reading 🙂