web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Send Email Attachment ...
Power Automate
Answered

Send Email Attachment issue

(0) ShareShare
ReportReport
Posted on by 143
Using Get files (props only) to get some files in doclib, then getting contents. Want to create array of objects for attachments in email.
 
Send Email V2 works, but attachments are corrupt. An array of these object is being returned from a flow. I'm using JSON on the returned string in the Attachments propert.
 
{
  "Name": @{item()?['{FilenameWithExtension}']},
  "ContentBytes": @{body('Get_file_content')?['$content']}
}

base64-ing the content didn't help. Solved this months ago but lost that code (and apparently didn't learn anything).
Categories:
I have the same question (0)
  • Suggested answer
    Robu1 Profile Picture
    1,610 Super User 2026 Season 1 on at
    Hi    ,
     
    Thank you for choosing Microsoft Community.
     
    Try building your attachments using a Select action with raw Base64 from Get file content — never wrap it in json(), never convert to string — and your attachments will stop corrupting.
     

    Select → Map:

    FieldValueNameitem()?['{FilenameWithExtension}']

    ContentBytesbody('Get_file_content')?['$content']

    This produces a true array of objects, exactly what Send Email V2 expects.

     
    I hope this helps resolve the issue! If you need more specific guidance, feel free to ask.
     
    🏷️ Please tag me @Robu1 if you still have any queries related to the solution or issue persists.
     
     
    ✅ Please click Accept as solution if my post helped you solve your issue and help others who will face the similar issue in future. ❤️ Please consider giving it a Like, If the approach was useful in other ways.
     
    Happy to help
    Robu 1👩‍💻
     
  • Suggested answer
    Pstork1 Profile Picture
    69,044 Most Valuable Professional on at
    Are you returning the array from the flow using the Respond To Power Apps action?  If you are then the whole thing is coming in as a string and you'll need to use the ParseJson() function on it and cast the pieces to the right data types.  But your question says you are using JSON on the returned string.  If licensing isn't an issue it would be better to return the array as an array using the HTTP Response action. That would let you return it as an array of files, with a schema, which you could then save in a collection.

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
  • Verified answer
    Greg Prickril Profile Picture
    143 on at
    Figured it out. When creating the array for Attachments, select the value for ContentBytes from Dynamic Data! I didn't have luck referring directly to body nor body?['$content']. After you select from Dynamic Data, it appears in the expression as Body, but that's not exactly what it is.
     
    Do not put value you choose from Dynamic Data in quotes (this is one of the permutations I tried).
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 333

#2
David_MA Profile Picture

David_MA 245 Super User 2026 Season 1

#3
Expiscornovus Profile Picture

Expiscornovus 202 Most Valuable Professional

Last 30 days Overall leaderboard