cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
kannan1
Helper I
Helper I

Attaching list item attachment to email

Dear All,

 

I was going through the below link to attach a list item's attachment to an email but wasn't able to get Append to array variable to work

https://www.techmeet360.com/blog/how-to-send-an-email-attachment-using-microsoft-flow/

 

kannan1_0-1606110368700.png

This is what i have used in the expression 

body('GetContent').$content
 
it gives me "Enter a valid json" error
1 ACCEPTED SOLUTION

Accepted Solutions
v-siky-msft
Community Support
Community Support

Hi @kannan1 ,

 

Actually, after my test, I found the problem is that you only obtained the '$content' from Attachment content, however, '$content-type' is also required.

Please just add 'Attachment Content' from dynamic content directly to the ContentBytes value as follows.

Snipaste_2020-11-25_13-16-51.pngSnipaste_2020-11-25_13-16-23.pngSnipaste_2020-11-25_13-19-23.png
 
Hope this helps.
Sik

View solution in original post

4 REPLIES 4
kannan1
Helper I
Helper I

found the answer here https://powerusers.microsoft.com/t5/Building-Flows/Email-Attachments-in-Flow/m-p/194363#M20085

 

{
  "Name": @{items('Apply_To_Each')?['DisplayName']},
  "ContentBytes": @{body('Get_attachment_content')?['$content']}
}
kannan1
Helper I
Helper I

For some reason the above didn't work 

I did all as said in the below link and the flow runs without any error. but the attachment in the email throws an error.  "looks like we dont support this file format" for .jpg file and similar for word and other file formats.

 

v-siky-msft
Community Support
Community Support

Hi @kannan1 ,

 

Actually, after my test, I found the problem is that you only obtained the '$content' from Attachment content, however, '$content-type' is also required.

Please just add 'Attachment Content' from dynamic content directly to the ContentBytes value as follows.

Snipaste_2020-11-25_13-16-51.pngSnipaste_2020-11-25_13-16-23.pngSnipaste_2020-11-25_13-19-23.png
 
Hope this helps.
Sik

Thank you very much, I was able to get it to work just by adding attachment content as you suggested.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Top Kudoed Authors
Users online (899)