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 problem wi...
Power Automate
Answered

Attachments problem with Send an email v2

(1) ShareShare
ReportReport
Posted on by 173
Hello guys,
 
i have a problem with attachments in "Send an email V2" in a flow.
 
i generate word documents with "Word online" and save it in sharepoint. 
 
 
 
My flow can generate between 1 and 4 documents, so I created a variable-array and use the function "Append to array".
 
code view :
 
{
  "type": "AppendToArrayVariable",
  "inputs": {
    "name": "VarAttachments",
    "value": {
      "Name": "@{outputs('Create_file_-_Attestation_Laptop_Word_Avocats')?['body/Name']}",
      "ContentBytes": "@{body('Get_file_content_-_Attestation_laptop_Word_Avocats')?['$content']}"
    }
  },
  "runAfter": {
    "Get_file_content_-_Attestation_laptop_Word_Avocats": [
      "Succeeded"
    ]
  }
}
 
I receive the attachments with good name and the right extension (docx), but all file are corrupted, i don't understand why...
 
 
I have try to modifify my "ContentBytes" in append my array with :
 
-content from get file content
 
"ContentBytes": "@{body('Get_file_content_-_Attestation_laptop_Word_Avocats')?['$content']}"
 
-generic value from get file content
 
"ContentBytes": "@{body('Get_file_content_-_Attestation_laptop_Word_Avocats')}"
 
-content from "popupale a microsoft word document"
 
"ContentBytes": "@{body('Populate_a_Microsoft_Word_template_-_Laptop_Avocats')}"
 
 
Every time, the result is the same: my attachments have the correct names and the .docx extensions, but the files are corrupted and unreadable.
 
 
Please help me :(
 
Categories:
I have the same question (0)
  • Suggested answer
    MS.Ragavendar Profile Picture
    6,961 Super User 2026 Season 1 on at
     
    In my case also getting attachment from sharepoint site and appending to array as shown but in your case where is for all loop (apply to each) i cannot see loop action.
     
     
     
    Sample Implementation 
     
     
    🏷️ Please tag me @MS.Ragavendar 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.
  • GreguS Profile Picture
    173 on at
    @MS.Ragavendar
     
    thank you for your reply, i don't use "for each" in this flow. i use a "condition / not empty" sharepoint value for create a word document
     
  • Verified answer
    Tomac Profile Picture
    4,061 Moderator on at
    @GreguS The issue is that you're using the old array format for attachments. I don't know when or why it changed, but attachment arrays must now be in this format:
    {
       "contentbytes": {
          "$content-type": "@{outputs('Get_Attachment_(V2)')?['body/contentType']}",
          "$content": @{outputs('Get_Attachment_(V2)')?['body/contentBytes']}
       },
       "Name": "@{outputs('Get_Attachment_(V2)')?['body/contentBytes']}"
    }
     
    You'll want to change the dynamic content in that example to match yours. This will prevent attachments from being corrupted files upon receipt.
     
    Note that there are no quotes around the value containing ContentBytes.

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!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 959

#2
Valantis Profile Picture

Valantis 872

#3
Haque Profile Picture

Haque 589

Last 30 days Overall leaderboard