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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Attachments Corrupted ...
Power Automate
Unanswered

Attachments Corrupted - For Selected File

(0) ShareShare
ReportReport
Posted on by 9

Hello all - 

 

Very new PA user here and building flows from scratch from videos and this community which have been very helpful. I know that there are some similar posts about this issue and I have tried to follow them but ultimately wind up more confused without arriving to a solution.

 

I have tried to generate an approval flow for a selected file (trigger) whereby a user can initiate the approval flow from a SharePoint library and include up to three attachments (though attachments are not required and may include anywhere from 0-3 attachments). I have been able to generate the requisite controls to append each attachment to an array variable and then have a conditional flow to determine the number of attachments listed and then have an email and approval step to follow each control step (not yet built out for conditions of 2 or 3 variables as I hope I can simply copy the steps for 1 attachment once it is built).

 

The conditions to check the value of an attachment is set as 

 

empty(triggerBody()?['file']?['contentBytes']) "is equal to" false
 
If true:
<<Append to array variable>>: 

{
"Name": "@{triggerBody()?['file']?['name']}",
"ContentBytes": "@{triggerBody()?['file']?['contentBytes']}"
}

 

After running for each potential attachment, there is an additional condition set as:

 

length(variables('Attachments')) "is greater than: 0
 
If true: 

Send an email -->

attachment: variables('Attachments')[0]['ContentBytes']

attachment name: variables('Attachments')[0]['Name']

 

 

I have been able to run through the flow and the attachments are correctly shown as attachments and names in the Approval request and the emails but are corrupted and do not open and I am lost on where the error happens. 

 

Attached are a few screenshots of the overall flow and some of what I assume to be the most relevant steps in the flow. Many thanks for any help or guidance available! 

Categories:
I have the same question (0)
  • ManishSolanki Profile Picture
    15,091 Super User 2025 Season 2 on at

    Hi @cfarrell 

     

    Pls perform the below steps:

     

    1. Click 'Switch to input entire array' button on the right side of attachment parameter in send an email action:

    ManishSolanki_0-1708339046027.png

    2. Now, select the attachment variable from the dynamic content window:

    ManishSolanki_1-1708339160256.png

     

     

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

     

  • cfarrell Profile Picture
    9 on at

    Thanks for your reply. This looks to be using the V2 of the send an email option, correct? For whatever reason, I am limited in using this action so this is unfortunately not arriving at a workable outcome.

  • Verified answer
    ManishSolanki Profile Picture
    15,091 Super User 2025 Season 2 on at

    Hi @cfarrell 

     

    In append to variable action, pls avoid using double quotes for contentBytes property:

    {
    "Name": "@{triggerBody()?['file']?['name']}",
    "ContentBytes": @{triggerBody()?['file']?['contentBytes']}
    }

     

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

  • cfarrell Profile Picture
    9 on at

    Thanks! Such a simple mistake but this appears to have been the solution!

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard