最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Sending base64 from outlook mail in HTTP - Power Automate - Stack Overflow

programmeradmin0浏览0评论

I need to create flow that allows me to send a PDF attachment from Outlook to my server as a parameter.

When I try to send content bytes from the action "Get Attachment(V2)", HTTP returns the error BadRequest.

<!DOCTYPE html>
<html style="height:100%">

<head>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
    <title> 400 Bad Request
    </title>
    <style>
        @media (prefers-color-scheme:dark) {
            body {
                background-color: #000 !important
            }
        }
    </style>
</head>

<body
    style="color: #444; margin:0;font: normal 14px/20px Arial, Helvetica, sans-serif; height:100%; background-color: #fff;">
    <div style="height:auto; min-height:100%; ">     <div
            style="text-align: center; width:800px; margin-left: -400px; position:absolute; top: 30%; left:50%;">
                    <h1 style="margin:0; font-size:150px; line-height:150px; font-weight:bold;">400</h1>
            <h2 style="margin-top:20px;font-size: 30px;">Bad Request
            </h2>
            <p>It is not a valid request!</p>
        </div>
    </div>
</body>

</html>

My flow:

I tried to use compose and, theoretically, it worked without any problems, but it doesn't send the correct base64 code:

In compose I can see input and output starting with: JVBERi0xLjYNJeLjz9MNCj... and I think this is correct because when I try to put it into base64 converter I can see the original file.

But the HTTP header looks like this:

"b64": "%PDF-1.6\r%����\r\n27 0 obj\n<</Filter/FlateDeco

It doesn't work. On the server side I need to send that base64 code via the API to an external tool called baselinker and I get an error response, while when I put the original base64 JVBERi0xLjYNJeLjz9MNCj into the address as GET parameter it works perfectly.

My third attempt was to format the output of compose in http. So instead of sending that output, I use

base64(outputs('Compose'))

And my last idea was:

base64(outputs('Get_Attachment_(V2)')?['body/contentBytes'])

In both result is the same as earlier: "b64": "%PDF-1.6\r%����\r\n2

Yesterday I tried to do that the other way, I cannot recreate it right now, but there was an error with the info that the request is too long.

Could you please help?

I'd like to have the possibility to use that flow when sending base64 to my server.

I need to create flow that allows me to send a PDF attachment from Outlook to my server as a parameter.

When I try to send content bytes from the action "Get Attachment(V2)", HTTP returns the error BadRequest.

<!DOCTYPE html>
<html style="height:100%">

<head>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
    <title> 400 Bad Request
    </title>
    <style>
        @media (prefers-color-scheme:dark) {
            body {
                background-color: #000 !important
            }
        }
    </style>
</head>

<body
    style="color: #444; margin:0;font: normal 14px/20px Arial, Helvetica, sans-serif; height:100%; background-color: #fff;">
    <div style="height:auto; min-height:100%; ">     <div
            style="text-align: center; width:800px; margin-left: -400px; position:absolute; top: 30%; left:50%;">
                    <h1 style="margin:0; font-size:150px; line-height:150px; font-weight:bold;">400</h1>
            <h2 style="margin-top:20px;font-size: 30px;">Bad Request
            </h2>
            <p>It is not a valid request!</p>
        </div>
    </div>
</body>

</html>

My flow:

I tried to use compose and, theoretically, it worked without any problems, but it doesn't send the correct base64 code:

In compose I can see input and output starting with: JVBERi0xLjYNJeLjz9MNCj... and I think this is correct because when I try to put it into base64 converter I can see the original file.

But the HTTP header looks like this:

"b64": "%PDF-1.6\r%����\r\n27 0 obj\n<</Filter/FlateDeco

It doesn't work. On the server side I need to send that base64 code via the API to an external tool called baselinker and I get an error response, while when I put the original base64 JVBERi0xLjYNJeLjz9MNCj into the address as GET parameter it works perfectly.

My third attempt was to format the output of compose in http. So instead of sending that output, I use

base64(outputs('Compose'))

And my last idea was:

base64(outputs('Get_Attachment_(V2)')?['body/contentBytes'])

In both result is the same as earlier: "b64": "%PDF-1.6\r%����\r\n2

Yesterday I tried to do that the other way, I cannot recreate it right now, but there was an error with the info that the request is too long.

Could you please help?

I'd like to have the possibility to use that flow when sending base64 to my server.

Share Improve this question edited Feb 3 at 2:45 President James K. Polk 42k28 gold badges109 silver badges145 bronze badges asked Jan 30 at 19:13 Łukasz ParadowskiŁukasz Paradowski 1 1
  • @K J I'm not sure if it is the problem. Becuase at the end I need code like this: "JVBERi0xLjYNJeLjz9MNCj". Or maybe I can transform it using php on the server. But even if it's possible I don't have idea how can correct that binary format in power automate. I will try, but maybe you could give me some hint. – Łukasz Paradowski Commented Jan 31 at 10:30
Add a comment  | 

1 Answer 1

Reset to default 0

in the Compose part, use the expression base64(outputs('Get_Attachment_(V2)')?['body']) to convert the attachment into base64 to be used in Header.

发布评论

评论列表(0)

  1. 暂无评论