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

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
ChristianAbata
Super User II
Super User II

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

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

Hi,

 

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

same should get send as attachment to outlook...

Hello @v-litu-msft 

 

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

 

 

Hello @v-litu-msft 

 

Yes, It's working 😀

Thank you very much for the solution and guidance.

 

Helpful resources

Announcements
MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (85,367)