cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
JoakimAndersson
Level: Powered On

Getting channel ID for channels in Teams?

Hello!

 

I have downloaded the following sample app to try and figure out how to send messages from my app to Teams: https://powerusers.microsoft.com/t5/Community-Apps-Gallery/Sample-Teams-Demo-App/m-p/86326#M18

 

I have managed to figure this formula out from the sample app:
MicrosoftTeams.PostMessageToChannel("Team-id-string", "channel-id-string", { body:{content: messageTB.Text, contentType:1 } })

This works as it should with no issues. When using the sampleapp I can look up the channel id for a newly created channel in the variable "channelResponse".

My question is: how do I find out what the id’s are for channels that already exist?

I have tried this formula:

MicrosoftTeams.GetChannelsForGroup(Team-id-string)

 

But this formula only returns a link:

https://graph.microsoft.com/beta/$metadata#groups('Team-id-string')/channels

 

This is an adress to an XML-file that only consists of miles of XML-code.

 

The id that I can find in the variable that works looks like this:
17:3151da3802ea43cd8701a684205978@thread.skype 

 

 

I how you guys have an awnser for me because I have tried everything Smiley Happy

 

 

Cheers,

Joakim

 

  

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
JoakimAndersson
Level: Powered On

Re: Getting channel ID for channels in Teams?

Hello @v-xida-msft!

 

Thank you for your answer but this does not work for me. The Teams-formulas seem unstable to me. If I try your work around I get this:

 

pa_issue.JPG

 

Now if I save, close and re-open the app I get his:

 

pa_issue2.JPG

 

This returns a description of the group and not the group name. At some point it did display the accurate name of the group but now it doesnt, it seems random.

 

Going over the issue today I found a way to get the channel nbame without the suggested work around. If I copy the URL for the channel I can extract the accurate channel-ID.

 

URL:
https://teams.microsoft.com/l/channel/19%3a3151da3802ea43cd8701a6faf4215978%40thread.skype/testi?groupId=a4c77160-21b4-4169-a683-5362475cf123&tenantId=1ffaf751-2c9b-46b8-a71b-845cf8b15f69

Just replace the parts marked blue with " : " and " @ " you get a valid channel-ID:

19:3151da3802ea43cd8701a6faf4215978@thread.skype

 

View solution in original post

3 REPLIES 3
Community Support Team
Community Support Team

Re: Getting channel ID for channels in Teams?

Hi @JoakimAndersson,

 

Do you want to get the Channel ID for existing channels in MS Teams?

 

I think there is something wrong with the formula that you provided.

 

I have made a test on my side, please take a try with the following workaround:7.JPG

 

8.JPG

 

9.JPG

 

 

Set the Items property of the Dropdown1 to following formula:

 

MicrosoftTeams.GetAllTeams().value

 

 

Set the Items property of the Dropdown2 to following formula:

 

MicrosoftTeams.GetChannelsForGroup(Dropdown1.Selected.id).value

On your side, you should modify your formula as below:

 

MicrosoftTeams.GetChannelsForGroup(Your-Team-id-string).value

 

Set the OnSelect property of the Button to following formula:

MicrosoftTeams.PostMessageToChannel(
Dropdown1.Selected.id, /* <-- Team Id */
Dropdown2.Selected.id, /* <-- Channel Id */
{
body:{
content:"PowerApps Test at 09/10/2018",
contentType:1
}
}
)

If you want to save the retrieved Channel Ids within a variable, please take a try with the following formula:

Set(channelResponse,MicrosoftTeams.GetChannelsForGroup(Dropdown1.Selected.id).value)

On your side, it is:

Set(channelResponse,MicrosoftTeams.GetChannelsForGroup(Your-Term-Id-string).value)

the variable looks as below:10.JPG

 

 

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
JoakimAndersson
Level: Powered On

Re: Getting channel ID for channels in Teams?

Hello and thank you for your awnser @v-xida-msft

 

I understand how your solution work but it doesn't work for me. The Teams-formulas seem unstable to me. When I try to replicate what you did this is my reslut:

 

pa_issue.JPG 

 

If I save, close and open the app again this is the result:

pa_issue2.JPG

Now this returns the description av the group and not the name of the group as it is supposed to. At one point it did display the correct name but now it doesn't. It seems random what value it returns.

Going over this issue today I found the awnser to my original question without the workaround you suggested. If I copy the channel-URL I get this:

https://teams.microsoft.com/l/channel/19%3a3151da3802ea43cd8701a6faf4215978%40thread.skype/testi?groupId=a2c77120-21b4-4169-a683-5342475cf123&tenantId=1ffaf731-2c9b-46b8-a71b-845cf8b15f67

Since I know the structure of a working channel-ID I figured out how to edit the url to get what I want. Replace % and the two folloing characters with " : " at the beginging of the string and then " @ " at the last part of the string:

19:3151da3802ea43cd8701a6faf4215978@thread.skype

 

This is the actual ID for the channel and it works as it should now.





  




JoakimAndersson
Level: Powered On

Re: Getting channel ID for channels in Teams?

Hello @v-xida-msft!

 

Thank you for your answer but this does not work for me. The Teams-formulas seem unstable to me. If I try your work around I get this:

 

pa_issue.JPG

 

Now if I save, close and re-open the app I get his:

 

pa_issue2.JPG

 

This returns a description of the group and not the group name. At some point it did display the accurate name of the group but now it doesnt, it seems random.

 

Going over the issue today I found a way to get the channel nbame without the suggested work around. If I copy the URL for the channel I can extract the accurate channel-ID.

 

URL:
https://teams.microsoft.com/l/channel/19%3a3151da3802ea43cd8701a6faf4215978%40thread.skype/testi?groupId=a4c77160-21b4-4169-a683-5362475cf123&tenantId=1ffaf751-2c9b-46b8-a71b-845cf8b15f69

Just replace the parts marked blue with " : " and " @ " you get a valid channel-ID:

19:3151da3802ea43cd8701a6faf4215978@thread.skype

 

View solution in original post

Helpful resources

Announcements
thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

Top Solution Authors
Top Kudoed Authors
Users online (6,760)