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 / How to get files attac...
Power Automate
Unanswered

How to get files attached from an email and send them into an Approval process

(1) ShareShare
ReportReport
Posted on by 256

Hello,

 

I need your expert advice in an Power Automate problem.

I would like to automatically process some email with attachments that should be sent to an approval process.

 

I have tried to get some inspiration from couple of articles:

I get the attachments into the approval email except they cannot be opened.

I have tried to replicate the original articles and from a SharePoint item it works perfectly.

What is different in my case - I get the attachments from an email message (that could return different type of data) and also composing the "AttachmentsArray" may have a different JSON format.

 

I have tried some simple JSON format:

{
"Name": "@{outputs('Get_Attachment_(V2)')?['body/name']}",
"Content":"@{outputs('Get_Attachment_(V2)')?['body/contentBytes']}"
}

and even a more complex one:

{
 "Name": "@{outputs('Get_Attachment_(V2)')?['body/name']}",
 "Content": {
 "contentType": "@{outputs('Get_Attachment_(V2)')?['body/contentType']}",
 "contentBytes": "@{outputs('Get_Attachment_(V2)')?['body/contentBytes']}"
 }
}

Tried even a base64 and base64ToString function to the content section but no luck. I get the correct email names in the approval email but bad content because files cannot be opened.

 

Here is the entire process, if may help in pointing me to the right direction:

 

EmailAttachmentsForApproval.png

 

I feel that Append To Array card is the culprit:

 

AppendToArray.png

Which as the following code in this moment:

{
 "inputs": {
 "name": "ApprovalAttachmentsArray",
 "value": {
 "Name": "@{outputs('Get_Attachment_(V2)')?['body/name']}",
 "Content": "@{base64ToString(outputs('Get_Attachment_(V2)')?['body/contentBytes'])}"
 }
 }
}

  

Any ideas? Which is the proper conversion from email attachments as the SharePoint list attachments are working properly?

 

Kind Regards,

Lucian

Categories:
I have the same question (0)
  • Verified answer
    Ellis Karim Profile Picture
    11,681 Super User 2025 Season 2 on at

    I experienced the same issues you described. After some searching and testing, I was able to open the attachments.

    In my case I am extracting attachments from the email trigger When a new email arrives (v3).  I use the attachments in an Approval, and also send the attachments to another recipient as an email. I used two separate arrays, one for the email action and the other for the approval after reading:

    These are the screenshots from my flow:

    appy2each.JPG

    append2Array.JPG

    This was the JSON I used for the Append to Array for Approvals:

     

     

    {
     "content": {
     "$content-type": @{items('Apply_to_each')?['contentType']},
     "$content": @{items('Apply_to_each')?['contentBytes']}
     },
     "name": @{items('Apply_to_each')?['name']}
    }

     

    append2ArrayApproval.JPG

    Hope this helps.

    Regards,

    Ellis

  • Lucian Profile Picture
    256 on at

    Hi @ekarim2020 

     

    You saved my life! Thank You! 👍

     

    Even I have used the same article as the one you've mentioned, it seems my mistake was adding and extra and unnecessary step "Get Attachment (V2)" instead of using the "Attachments Item" directly.

     

    Now it works. Thank you!

     

    Kind Regards,

    Lucian

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