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

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
Community Support Team
Community Support Team

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

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
Community Support Team
Community Support Team

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

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

DanielS1
Level: Powered On

Re: Get Teams name and Teams Channel

Thanks for the responses, both. This is perfect! 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (4,462)