cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DanielS1
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
v-bacao-msft
Community Support
Community Support

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

Expiscornovus
Super User
Super User

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
v-bacao-msft
Community Support
Community Support

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

Expiscornovus
Super User
Super User

Hi @DanielS1,

 

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

 

triggerbodyweburl.png

View solution in original post

Thanks for the responses, both. This is perfect! 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (1,851)