cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AveStar
Frequent Visitor

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

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 

1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Super User
Super User

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.

View solution in original post

4 REPLIES 4
Expiscornovus
Super User
Super User

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
Frequent Visitor

Expiscornovus
Super User
Super User

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.

View solution in original post

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,579)