Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Assign Members to Team and Tag using email addresses listed in Excel sheet

(0) ShareShare
ReportReport
Posted on by 29

Hi Experts,

 

I'm trying to build a simple flow so as to add Teams member using their email address listed in an Excel sheet to a team on Teams and assign them with a choosen tag.

 

I was able to add members to the team, but I'm stuck at the other step which is to assign them the tag which was set up in the same team. In particular, I have no glue how to obtain the user ID from their email address.

 

Any advice on how I should build the flow? Thanks a ton!

albusbui_0-1703779527163.png

 

  • albusbui Profile Picture
    29 on at
    Re: Assign Members to Team and Tag using email addresses listed in Excel sheet

    Thanks @creativeopinion  --- I hadn't seen your post before sharing my quick solution. Thanks for your detailed suggestion which would help me to set up a smarter flow for similar cases. Appreciated!

    Best

  • Verified answer
    albusbui Profile Picture
    29 on at
    Re: Assign Members to Team and Tag using email addresses listed in Excel sheet

    Found a quick and dirty solution 🙂 I create a second flow, which is triggered by new member added to the team, to assign the tags to the added members (one time only)

  • Verified answer
    creativeopinion Profile Picture
    10,450 Super User 2025 Season 1 on at
    Re: Assign Members to Team and Tag using email addresses listed in Excel sheet

    @albusbui You need to add a couple of actions to your flow. 

     

    I'm still using the Classic Designer, you'll need to switch to follow along. I would also recommend creating a new flows so that you are able to run tests at each stage of the flow.

    creativeopinion_0-1703789274614.png

     

    Tip: Remember to rename your actions to keep things organized!

    Limit Top Count

    Depending on how many items you have in your Excel table, I would recommend limiting the Top Count to a smaller number than the total number of items in your list. This will increase the speed of your flow runs. Instead of returning all items in your table—it'll limit the List rows present in a table action to the number entered here.

     

    creativeopinion_4-1703789815638.png

     

    Get Team Tags

    Add a List all tags for a team action to your flow.

    creativeopinion_3-1703789632097.png

    Loop through Each Row

    In the Apply to Each action, insert a Filter Array action. You'l use this Filter Array action to filter the results returned from the List all tags for a team action based on the data in your Excel table. I'm assuming you have a column in your Excel table with the tag name.

     

    To learn more about how to use the Filter Array action, please refer to this YT Tutorial: Are you using the Microsoft Power Automate Filter Action wrong?

     

    In the From field, insert the value dynamic content from the List all tags for a team action. In the first value field, insert the Name dynamic content from the List all tags for a team action. In the second value field, insert the dynamic content from the List rows present in table action that contains your tag name. In my case, it's the Tag column.

     

    Leave the operator as is equal to. It's important to note that the text in your Excel table must match the tag name exactly since you are using the is equal to operator. This includes the case used.

    creativeopinion_5-1703789858385.png

    This next step is optional—however recommended. 

     

    Whenever I use a Filter Array action, I always like to return the count of items returned in a Compose action. This is helpful when building a flow and can also be used to troubleshoot your flow. Insert a Compose action. Add an Expression. Use the length() function.

    creativeopinion_6-1703789887186.png

     

    Select the Dynamic content tab and insert the body dynamic content from the Filter Array action into the length() function.

     

    creativeopinion_7-1703789909102.png

    Run a test. Ensure that the Compose action is returning a 1. If not, there is something wrong with your Filter Array condition. You'll need to adjust it so that the Compose action returns a 1.

    creativeopinion_8-1703789938950.png

    Condition Check

    Add a Condition action to your flow. Your flow should only continue if a matching tag was found. Otherwise nothing should happen—or you can send yourself a notification if a tag isn't found. For that, you can insert additional actions into the NO brach of your Condition action. 

     

    In the first value field, insert the output from the Compose action above. Change the operator to is not equal to and enter a zero into the second value field.

    creativeopinion_9-1703789963720.png

    Get the Tag ID

    Take a look at the Filter Array outputs from the previous test. You'll need the dynamic content key for the next action you add. The dynamic content key is the red text between the double quote marks. I cover how to access dynamic content in this section of the tutorial.

    creativeopinion_11-1703790085125.png

    The Filter Array action will always return an array of items—even if there is only a single item returned. It'll still be in an array. To avoid the Apply to Each action, you'll need an expression. 

     

    Add a Compose action to your flow. The Compose action is optional—you can insert the expression directly into the Add a member to a tag action, however I prefer to use Compose actions in my flows so that I can run tests on expressions that I use.

     

    The first item in an array is [0]. In the expression field insert this expression:

    ?[0]['id']

    Note that the dynamic content key is entered between the single quotes.

    creativeopinion_12-1703790116341.png

    Go to the start of the expression by pressing the up arrow key. Click on the Dynamic content tab and insert the body dynamic content from the Filter Array action. 

    creativeopinion_13-1703790140213.png

    Run a test. Verify that the Compose action is returning the Tag IDs's.

    creativeopinion_14-1703790170814.png

    Add Member to Team

    Add the Add a member to a team action. Insert the dynamic content from the List rows present in a table action that contains the user's email. In my case, it's Email.

    creativeopinion_16-1703790212561.png

    Get User ID

    Add a Get user profile (V2) action to your flow. Insert the dynamic content from the List rows present in a table action that contains the user's email into the User (UPN) field. In my case, it's Email.

    creativeopinion_18-1703790298765.png

    Add Member to Tag

    Add the Add a member to a tag action. Select your team and for the Tag ID, select Enter custom value.

    creativeopinion_15-1703790204340.png

    Insert the output from the Compose action storing the Tag ID.

    creativeopinion_17-1703790237961.png

    creativeopinion_19-1703790318517.png

     

    Run a test.

     

    Hope this helps!

    If I helped you solve your problem—please mark my post as a solution ✅.
    Consider giving me a 👍 if you liked my response!

    👉 Watch my tutorials on YouTube
    👉 Tips and Tricks on TikTok

    If you'd like to level up your Power Automate skills check out this video: Power Automate Beginner Tips and Tricks | 5 Things You Need to Know – Part 1

    I cover the following in this video tutorial:

    ✅ Power Automate Beginner Tips and Tricks

    ✅ Why use the Manual Trigger instead of an Automated Trigger

    ✅ 3 Ways a Compose Action can help you build better flows

    ✅ How to Manually Trigger a flow with a specific Date and Time

    ✅ How to return a count of items

    ✅ How to use the top count

    ✅ How to send test emails

     

     

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1