Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Using Flows
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

 

  • Rohit4044041 Profile Picture
    258 on at
    Re: How to HTTP POST email attachment as ByteArray?

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

  • vaibhavtiwari Profile Picture
    16 on at
    Re: How to HTTP POST email attachment as ByteArray?

    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
                                        ]
     
  • AlexRUiLs Profile Picture
    Microsoft Employee on at
    Re: How to HTTP POST email attachment as ByteArray?

    Does anyone know how to solve the issue?

  • AlexRUiLs Profile Picture
    Microsoft Employee on at
    Re: How to HTTP POST email attachment as ByteArray?

    @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.

     
  • v-litu-msft Profile Picture
    on at
    Re: How to HTTP POST email attachment as ByteArray?

    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.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,658 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,999 Most Valuable Professional

Leaderboard

Featured topics

Restore a deleted flow