web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Add Members to private...
Power Automate
Answered

Add Members to private Channel when a member is in a team Group

(0) ShareShare
ReportReport
Posted on by 17

Hey I saw your reply on the post before about adding Members to private channels automatically but what i don't understand is how to write the commands for it on the HTTP , i am a beginner at this but i know your reply was the solution, just don't know which expression to put or how to copy and paste the right ones

@Expiscornovus 

Categories:
I have the same question (0)
  • Expiscornovus Profile Picture
    33,478 Most Valuable Professional on at

    Hi @AveStar,

     

    Just to double check. Are you talking about this reply?

    https://powerusers.microsoft.com/t5/General-Power-Automate/Add-members-to-private-channel-from-power-automate/m-p/898581/highlight/true#M69217

     

  • AveStar Profile Picture
    17 on at

    Yup exactly this one

    Since i am new to this, i didn't know how you putted these expressions and are the rest copy and paste? Or is there something else to change besides the expressions? So far what i have is my trigger which is when a team memeber is added then i am waiting on the Http action part

     

  • AveStar Profile Picture
    17 on at

    @Expiscornovus 

  • Verified answer
    Expiscornovus Profile Picture
    33,478 Most Valuable Professional on at

    Hi @AveStar,

     

    One of the things which should be mentioned is that a prerequisite is the setup the registration of an app in Azure AD with sufficient permissions (in this case ChannelMember.ReadWrite.All, https://docs.microsoft.com/en-us/graph/api/channel-post-members?view=graph-rest-1.0&tabs=http) to execute these tasks in a HTTP action.

     

    Lee Ford has written an nice blogpost about setting up that Authentication:

    https://www.lee-ford.co.uk/using-flow-with-graph-api/

     

    When you have setup that Authentication you could use the steps below for your flow setup.

     

    1. Use the when a team member is added trigger action

    whenateammemberisadded.png

     

    2. Add a initialize variable action of type string. Call it TeamId.

    Make sure you use the correct id of the Team as the value you want to add the members to.

     

    teamid.png

     

    3. Add a second initialize variable action of type string. Call it PrivateChannelId.

    Make sure you use the correct id of the Channel as the value you want to add the members to.

     

    privatechannelid.png

    4. Add a HTTP action. Use the POST method.

     

    4.1. Copy/paste the below code snippet in the URI field:

    https://graph.microsoft.com/beta/teams/@{variables('TeamId')}/channels/@{variables('PrivateChannelId')}/members

     

    4.2. Copy/paste the below code snippet in the Headers field (switch to Headers to text mode before you paste). 

    {
     "Content-Type": "application/json",
     "Accept": "application/json"
    }

     

    headers_textmode.png

     

    4.3. Copy/past the below code snippet in the Body field.

    {
    "@@odata.type": "#microsoft.graph.aadUserConversationMember",
     "roles": [
     "member"
     ],
     "user@odata.bind": "https://graph.microsoft.com/beta/users('@{triggerOutputs()?['body/id']}')"
    }

     

    4.4. Make sure you configure the Authentication to use Active Directory OAuth and use the values (Client Id, Client Secret, etc.) from your App you registered in Azure AD.

    In my example I used parameters like TenantId, ClientId_MicrosoftTeams instead. Replace those parameters by your Ids).

     

    addmembertoprivatechannel.png

     

    Hope this helps a bit.

  • PabloMartini Profile Picture
    20 on at

    Thanks for this, taking my first steps in using flow to call APIs and this was very helpful. Though I've spent far too long today troubleshooting an error because I left an @ out from step 4.3!

  • Ganjys Profile Picture
    2 on at

    Would it be possible to only give the app permission to write channel members only on specific team?

    On a large tenant ChannelMember.ReadWrite.All is not an easy permission to give.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
trice602 Profile Picture

trice602 248 Super User 2026 Season 1

#2
David_MA Profile Picture

David_MA 207 Super User 2026 Season 1

#3
Power Platform 1919 Profile Picture

Power Platform 1919 101 Super User 2026 Season 1

Last 30 days Overall leaderboard