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 / Attachments become cor...
Power Automate
Answered

Attachments become corrupted when emailed via an attachment array

(0) ShareShare
ReportReport
Posted on by 7
Hello,
 
I'm trying to include attachments from an attachment field in a SharePoint list so that multiple attachments may be dynamically included. I'm able to set up the array and send attachments, but they become corrupt and can't be opened. 
What might I be doing wrong in my flow?
The current structure is:
 
- When a new item is created
- Initialize array variable
- If has attachments is true
  - Get attachments, ID from the list item created
  - Apply to each, body from Get Attachments
    - Get attachment content, ID = ID from list item, File identifier = Id from Get Attachments
    - Append to array:
      {
        "Name": "@{items('Apply_to_each')?['DisplayName']}",
        "ContentBytes": "@{outputs('Get_attachment_content')?['body']?['$content']}"
      }
  - Send an email, attachment array in the attachments field
 
 
Screenshot 2026-0...
Screenshot 2026-0...

Your file is currently under scan for potential threats. Please wait while we review it for any viruses or malicious content.

Categories:
I have the same question (0)
  • DD-26051314-0 Profile Picture
    2 on at
    What is the file type of your attachments? Try adding the file type to the file name using concat().
     
    For example, if your file types are PDF:
     
          {
            "Name": concat("@{items('Apply_to_each')?['DisplayName']}", '.pdf'),
            "ContentBytes": "@{outputs('Get_attachment_content')?['body']?['$content']}"
          }
  • Verified answer
    Tomac Profile Picture
    4,153 Moderator on at
     
    The first thing to do is to try removing the quotes around the ContentBytes section of your array:
          {
            "Name": "@{items('Apply_to_each')?['DisplayName']}",
            "ContentBytes": @{outputs('Get_attachment_content')?['body']?['$content']}
          }
     
     
    If this error is still happening after that, sometimes (but not always) there is a known issue on the official documentation page (scroll down to the screenshots to see this part), you'll need to use the new attachments array format:
    {
    	"Name": @{items('Apply_to_each')?['DisplayName']},
    	"ContentBytes": {
    		"$content": @{outputs('Get_attachment_content')?['body']?['$content']},
    		"$content-type": @{outputs('Get_attachment_content')?['body']?['$content-type']}
    	}
    }
     
    Between these two options, one of them should resolve the issue.
  • SA-25051734-0 Profile Picture
    7 on at
    Thank you @Tomac, the new attachments array format worked! The image emailed successfully and was not corrupted. I have not tested this with multiple files in the array, but feeling good about it after overcoming this hurdle. 

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 377

#2
11manish Profile Picture

11manish 279

#3
David_MA Profile Picture

David_MA 234 Super User 2026 Season 1

Last 30 days Overall leaderboard