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 HTTP POST email...
Power Automate
Unanswered

How to HTTP POST email attachment as ByteArray?

(1) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello,

I am trying to POST an email (Outlook) PDF attachment file to my Azure Function by HTTP POST.

The function knows to take POST body, which should contain PDF byte array, and process it. (Tested with Postman, works.) 

But if I send it from the Flow as HTTP POST request with the body of "Attachments Content", it arrives at the function in the wrong format. Function logic doesn't recognize it as PDF.
How should I send the attachment file content so it will arrive as correct byte array?

 

AlexRUiLs_1-1594331151035.png

 

AlexRUiLs_0-1594331083532.png

 

Categories:
I have the same question (0)
  • v-litu-msft Profile Picture
    on at

    Hi @AlexRUiLs,

     

    How about using the base64() function to convert the attachment content into the base64 code? Then append it into the HTTP request body?Annotation 2020-07-10 133356.jpg

     

    Best Regards,
    Community Support Team _ Lin Tu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • AlexRUiLs Profile Picture
    Microsoft Employee on at

    @v-litu-msft Tried. The same problem.

    AlexRUiLs_2-1594402047351.png

     

    My Azure function code: 

    AlexRUiLs_1-1594402018678.png

    As I said above this code works well when I post a file from Postman.

     
  • AlexRUiLs Profile Picture
    Microsoft Employee on at

    Does anyone know how to solve the issue?

  • vaibhavtiwari Profile Picture
    16 on at

    I tried the solution but it doesn't convert it to ByteArray

    used this in expression

    base64(items('Apply_to_each_2')?['contentBytes'])
    vaibhavtiwari_0-1649755970326.png

     

    the output come like this 
    vaibhavtiwari_1-1649756041116.png

     

     as we can see i also tried using  
    base64ToBinary(outputs('Compose')) to the output of 

    base64(items('Apply_to_each_2')?['contentBytes']) but that also doesn't work

     

    The expected output is to be in form of like below

     

    [
                                            84,
                                            101,
                                            115,
                                            116,
                                            32,
                                            65,
                                            116,
                                            116,
                                            97,
                                            99,
                                            104,
                                            109,
                                            101,
                                            110,
                                            116
                                        ]
     
  • Rohit4044041 Profile Picture
    286 on at

    Any luck on this? I am facing similar issue. Works fine with Postman. 

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 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard