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 😁
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
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.
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 🙂
Running the flow, the branching should work as expected, and the users added in Teams!
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%.
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)
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.
With regards to the ELSE statement, we do the same, but we set the Owners parameter to True.
The entire desktop flow will look like this:
After running the flow, if everything went well, users are also added correctly!
Thanks for reading 🙂