cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

Get Teams name and Teams Channel

Hi, 

 

I'm trying to use the "When a new channel message is added" trigger that works on a specified team sire and channel. When a message is added, the flow takes certain message values and creates a sharepoint item with them. That works fine. However, I'd like to also include the team name or ID and channel name or ID in the sharepoint item. The standard options in the flow don't include either, so I think I need to use an expression to return them. I have tried the following without success: 

string(triggerOutputs()?['webUrl'])
 
Does anyone know how I can extract:
- Team name or ID
- Channel or ID
 
And post it to the item column in sharepoint? 
2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Get Teams name and Teams Channel

Hi @DanielS1 ,

 

Please try to use following expression to get Team ID and Channel ID.

Team ID:

first(split(last(split(triggerBody()['webUrl'],'groupId=')),'&tenantId'))

Channel ID:

replace(replace(last(split(first(split(triggerBody()['webUrl'],concat('/',triggerBody()?['etag']))),'message/')),'%3A',':'),'%40','@')

12.PNG

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Resolver I
Resolver I

Re: Get Teams name and Teams Channel

Hi @DanielS1,

 

You should be able to use triggerbody()?['webUrl']. Can you test this expression?

 

triggerbodyweburl.png

View solution in original post

3 REPLIES 3
Highlighted
Community Support
Community Support

Re: Get Teams name and Teams Channel

Hi @DanielS1 ,

 

Please try to use following expression to get Team ID and Channel ID.

Team ID:

first(split(last(split(triggerBody()['webUrl'],'groupId=')),'&tenantId'))

Channel ID:

replace(replace(last(split(first(split(triggerBody()['webUrl'],concat('/',triggerBody()?['etag']))),'message/')),'%3A',':'),'%40','@')

12.PNG

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Resolver I
Resolver I

Re: Get Teams name and Teams Channel

Hi @DanielS1,

 

You should be able to use triggerbody()?['webUrl']. Can you test this expression?

 

triggerbodyweburl.png

View solution in original post

Highlighted
New Member

Re: Get Teams name and Teams Channel

Thanks for the responses, both. This is perfect! 

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

Top Solution Authors
Top Kudoed Authors
Users online (8,545)