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

Send mail with attachment when a new message and file posted in Teams channel

Hello Everyone,

 

I'm facing a issue to send mail with attachment when a new message with attached file posted in Team channel.

I'm able to create flow to send message when posted message in channel but file is not getting send as attachment.

 

Could you please try and let me know what expression I should try.

 

 

Thank you in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Send mail with attachment when a new message and file posted in Teams channel

Hi @asingh8111,

 

You could following these steps to send an email with attachments when a message upload a file into a channel in MS teams:

 

  1. My team named Westeros, and I create a trigger when a new channel message is added, you could create a condition under it to whether has attachment in a newly added message to determine the following steps. For a better explanation, I didn't create it.
  2. Initialize an array variable named Attachment to store File attachments.
  3. Create Apply to each action to loop through attachments get from channel message.
  4. Get Filename by using the expression: item()?['name']
  5. Get SiteAddress by using the expression: split(item()?['contentUrl'],'/Shared Documents')[0]
  6. Get FilePath by using the expression (the 'Westeros is my team's name, you should use yours'): split(item()?['contentUrl'],'Westeros')[1] 
  7. Then add Get file content action of SharePoint connector, put the output of the step 5 and 6.
  8. Add Append to an array variable action, when you append the contentByte field, you should convert the file content into base64 by base64() function.
  9. After the loop, put the variable into the send email action.

Annotation 2020-03-10 134143.png

 

Annotation 2020-03-10 134144.png

 Annotation 2020-03-10 134145.png

 

Best Regards,
Community Support Team _ Lin Tu
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

5 REPLIES 5
Highlighted
Super User
Super User

Re: Send mail with attachment when a new message and file posted in Teams channel

hi @asingh8111  the message sended to teams as attachments? for example as .msg



Did I answer your question? Please consider to Mark
my post as a solution! to guide others :winking_face:

Proud to be a Flownaut!


If you want you can follow me at www.christianabata.com Quieres contenido en español? Síguenos en Power Automate LA
Highlighted
Community Support
Community Support

Re: Send mail with attachment when a new message and file posted in Teams channel

Hi @asingh8111,

 

You could following these steps to send an email with attachments when a message upload a file into a channel in MS teams:

 

  1. My team named Westeros, and I create a trigger when a new channel message is added, you could create a condition under it to whether has attachment in a newly added message to determine the following steps. For a better explanation, I didn't create it.
  2. Initialize an array variable named Attachment to store File attachments.
  3. Create Apply to each action to loop through attachments get from channel message.
  4. Get Filename by using the expression: item()?['name']
  5. Get SiteAddress by using the expression: split(item()?['contentUrl'],'/Shared Documents')[0]
  6. Get FilePath by using the expression (the 'Westeros is my team's name, you should use yours'): split(item()?['contentUrl'],'Westeros')[1] 
  7. Then add Get file content action of SharePoint connector, put the output of the step 5 and 6.
  8. Add Append to an array variable action, when you append the contentByte field, you should convert the file content into base64 by base64() function.
  9. After the loop, put the variable into the send email action.

Annotation 2020-03-10 134143.png

 

Annotation 2020-03-10 134144.png

 Annotation 2020-03-10 134145.png

 

Best Regards,
Community Support Team _ Lin Tu
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
Frequent Visitor

Re: Send mail with attachment when a new message and file posted in Teams channel

Hi,

 

Any file uploaded or posted in channel like, xls, pdf, txt etc...

same should get send as attachment to outlook...

Highlighted
Frequent Visitor

Re: Send mail with attachment when a new message and file posted in Teams channel

Hello @v-litu-msft 

 

Thanks for the reply, let me try and will update you..

 

 

Highlighted
Frequent Visitor

Re: Send mail with attachment when a new message and file posted in Teams channel

Hello @v-litu-msft 

 

Yes, It's working 😀

Thank you very much for the solution and guidance.

 

Helpful resources

Announcements
firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

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
Users online (6,744)