Upload File using Logic app - Multipart

Rahul Shrivastav 0 Reputation points
2024-07-21T18:08:53.1166667+00:00

Reading a PDF File from SharePoint using Logic app Action Get File Content and uploading to an API (using multipart headers). The file gets uploaded but when I open it is blank. The same file works fine if uploaded using Postman

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
3,118 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,667 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Ryan Hill 28,101 Reputation points Microsoft Employee
    2024-07-25T14:43:53.49+00:00

    @Rahul Shrivastav

    The connector will need to format the request into a JSON body. Make sure you configure your HTTP Connector similar to the following:

    "HTTP_action": {
       "inputs": {
          "body": {
             "$content-type": "multipart/form-data",
             "$multipart": [
                {
                   "body": "@trigger()",
                   "headers": {
                      "Content-Disposition": "form-data; name=file; filename=myExcelFile.xlsx"
                   }
                }
             ]
          },
          "method": "POST",
          "uri": "https://finance.contoso.com"
       },
       "runAfter": {},
       "type": "Http"
    }
    

    where triggerbody() is the file content. Check for any difference between this and your Postman request.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.