Search code examples
pdfsharepointbase64azure-blob-storageazure-logic-apps

Logic App PDF File from Sharepoint uploading to Azure Blob is Blank


I currently have a Logic App Workflow that retrieves files (PDFs) from Sharepoint successfully (200 response code with content in the body). I then want to upload these files to Blob Storage.

The upload to blob works successfully, but when I download & open any of the PDF files - they are completely blank.

I have a simple workflow as follows:

  1. Sharepoint HTTP Get request to my URI
  2. Returned the $content with content-type: application/octet-stream
  3. Use a compose action to convert my Sharepoint Get Content to Binary using base64ToBinary()
  4. Create Blob V2 using newly converted binary string as the file content (example.pdf)

The strange thing is the files are NOT empty. However the PDF's are approximately double the size of the source files.

When I put the $content string into an online Base64 to PDF converter - it converts perfectly fine and I can see all the content/pages in the right place.

I have tried the following:

  • Using base64ToString() to convert the REST call content
  • Using base64ToBinary() to convert the REST call content
  • Adding the Content-type header for the Create Blob V2 action to application/pdf
  • Adding binaryStringResponseBody=true in the REST request URI
  • Adding the Accept header in the GET request as application/pdf

I am expecting to see the PDF contents in full when I download/open them from Azure Blob.


Solution

  • You can follow below design to get desired results:

    enter image description here

    Then:

    enter image description here

    Full Design:

    enter image description here

    Note:

    Use .pdf in after name like below:

    enter image description here

    Files(pdf) in sharepoint :

    enter image description here

    Output:

    enter image description here