Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Attachment is corrupted when sent through manual trigger

(0) ShareShare
ReportReport
Posted on by 1,091

I have a very simple flow with manual trigger where am trying to attach a file. I am sending the attachment through send an Email(v2) action and attachments go through fine when I pass file name and content like below

 

RameshMukka_0-1645089782583.png

Now when I want to use a array variable like below, the email attachments are sent but came as corrupted. I have been struggling for hours to find my mistake but couldn't solve it. Can someone help me please?

 

RameshMukka_1-1645090149027.png

 

  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    on at
    Re: Attachment is corrupted when sent through manual trigger

    Hi @RameshMukka,

    You should change the Base64 to binary:

    vqiaqimsft_0-1645511522753.png

    base64ToBinary(triggerBody()?['file']?['contentBytes'])
    
    
  • rameshmukka Profile Picture
    1,091 on at
    Re: Attachment is corrupted when sent through manual trigger

    @v-qiaqi-msft 

    I am using the trigger "For a Selected File" from SharePoint and added a file parameter. The file content already coming from manual trigger. So I dont have to use Get-FileContent anywhere. Here is my flow. The file displayname and contentBytes both coming directly from attachments during manual trigger. As attaching file is optional for the requirement, the flow runs fine when there is an attachment but fails when there is no attachment because attachment name and content in Send an Email (V2) cannot be blank so I opted to use Array. I feel I format my attachments correct in the array. Don't know where else is the problem. Here is my flow.

    RameshMukka_1-1645441278262.png

    RameshMukka_2-1645441336449.png

    RameshMukka_3-1645441400952.png

     

     

     

  • v-qiaqi@microsoft.com Profile Picture
    on at
    Re: Attachment is corrupted when sent through manual trigger

    Hi @RameshMukka,

    Could you please share the complete flow configure with me?

     

    If you want to use the Appen to array, you should append all the attachment value to the array variable which we initialized before. Fill the fields as follows:

    • Name – attachments
    • Value – {

                     “Name”: “Use Dynamic content – Display Name”
                     “ContentBytes”: “Add Expression – body(‘GetContent’).$content

                            }

    The ContentBytes parameter holds the actual attachment.

     

    In a word, if you use the append to array, you should format your attachments as an array using the attachment display name and content, which could be captured using the Get file content. Then you could get the file name with extension for Name parameter and file content for 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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 566 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 516 Super User 2025 Season 1

#3
stampcoin Profile Picture

stampcoin 492