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
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?
Hi @RameshMukka,
You should change the Base64 to binary:
base64ToBinary(triggerBody()?['file']?['contentBytes'])
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.
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”: “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.
Michael E. Gernaey
566
Super User 2025 Season 1
David_MA
516
Super User 2025 Season 1
stampcoin
492