Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Create a Flow to add members to Teams site based on data in a table

(1) ShareShare
ReportReport
Posted on by 56

I want to create a Flow to add members to a Teams site based on data in a table (i.e. the member's email address and the Team ID (amongst other data) will be in a table, as not every member is added to the same Teams site)

 

The Teams site will be created manually before the Flow is activated for the first time to add the members.

 

mhorn30_0-1601465759223.png


Where do I find the "Team ID" that I need to add in the Flow? (Clicking on "Get link to team" inside my team provides me with a long URL that contains a "groupId", will it be this?)

 

And I assume the "user AAD ID" is the email address of the user? (All users are inside the tenant, i.e. no guests).

Thank you.

  • rohanc Profile Picture
    10 on at
    Re: Create a Flow to add members to Teams site based on data in a table

    Hi @abihoughton27, great question! It's from Office 365 user (but add the "User id", not the email address). The "value" output of "Search for users (V2)" is already the "User id", I think. The original email (and also in general the Excel file) is only to find that "User id". Once you've got the "User id", you don't directly use the email address to add the user because you've unlocked the mapping to the underlying Office 365 info that you really wanted in the first place. Hope this helps!

     

    rohanc_0-1699262779220.png

     

  • abihoughton27 Profile Picture
    on at
    Re: Create a Flow to add members to Teams site based on data in a table

    @rohanc - Thank you for that last example super clear - at the bottom on the action add a team member - what did you add was it email from office 365 user?

    abihoughton27_0-1699019676843.png

    or email from the excel?

    abihoughton27_1-1699019713032.png



    Thanks is advanced 🙂 

  • rohanc Profile Picture
    10 on at
    Re: Create a Flow to add members to Teams site based on data in a table

    Thanks all. This solution was definitely the right one for me with a small bit of tweaking: I also had trouble using the email address to get the Profile because, in my organisation, individual users sometimes have more than one email address and sometimes have UPNs that are different to their email addresses.

     

    I found an Operation that resolves all these issues:

    "Search for users (V2)" instead of using "Get user profile (v2)"

    Retrieves the user profiles that match the search term (V2).

    Linked here: Office 365 Users - Connectors | Microsoft Docs

     

    rohanc_0-1649191393123.png

     

    I think this works for everyone, since email addresses should be unique (ie each email address only links to one user, even if it is not the email address for the UPN or even if the UPN has been configured to be something different to the email address).

     

    I tried to publish this as a template (so you could just search for the template "Add Member to a Teams Group"), but am not sure if that will be successful.

  • HWib Profile Picture
    103 on at
    Re: Create a Flow to add members to Teams site based on data in a table

    It seems like you have to use the Get User Profile as @anubhav247  mentioned.

    The user AAD has to match with what's in AAD.

    So if in AAD it's lower case, it will have to be in lower case.

    if in AAD it's upper case, it will have to be in upper case.

    Get user profile, Mail will pull up whatever is registered. I tried the lower case expresssion and gets an error. But working when I use the get user profile Mail. 

    Hope this helps for those who gets similar error.

  • CU07080701-0 Profile Picture
    on at
    Re: Create a Flow to add members to Teams site based on data in a table

    I had to use a different method to solve the issue of "user not found". Teams AAD ID emails only seems to like lowercase emails, so I converted them with expression toLower(email). I don't know if the "Get User Profile" step is still needed.

    johnnyshield_0-1625006051293.png

     

  • anubhav247 Profile Picture
    47 on at
    Re: Create a Flow to add members to Teams site based on data in a table

    For all future visitors it might help....

     

    I tried writing just the email id for "user AAD ID" which gave me error "user does not exist".

     

    So here is what i did insteadimage.png

  • Verified answer
    mhorn30 Profile Picture
    56 on at
    Re: Create a Flow to add members to Teams site based on data in a table

    So to answer my own question:

     

    1. The Team ID is the "groupId". You can find this by clicking on the ellipse next to your Teams site and choosing "Get link to team". Copy the id (numbers) after "groupId=" and  before "&tenantId="

    mhorn30_0-1601481288825.png

     

    2. The "user AAD ID" is the email address of the user associated with the tenant (i.e. xxxx@company.com)

     

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