question

ErshadNozari-6158 avatar image
0 Votes"
ErshadNozari-6158 asked ErshadNozari-6158 answered

Extracting $content value from JSON in “File Content” when using the SharePoint “Get file content using path” action

I'm using the "Get file content using path" to retrieve a PDF document from SharePoint.

50288-image.png


In the subsequent "Set variable" action I then need to access the value of the $content property to build a json request like so:

50266-image.png

This is currently not working for me as I am getting the following error in the "Parse JSON" action at runtime:

**BadRequest. The property 'content' must be of type JSON in the 'ParseJson' action inputs, but was of type 'application/pdf'.

The schema for my Parse JSON action looks as follow:
50344-image.png

How can get the value of $content property from the "File Content" action output?


By the way below does not work
50313-image.png
as my JSON ends up like this:

   "Attachments": [
     {
       "AttachmentData": {
         "$content-type": "application/pdf",
         "$content": "JVBERi0xLjQN......."
       },
       "AttachmentName": "Hollow.pdf"
     }
   ]


azure-logic-apps
image.png (14.2 KiB)
image.png (17.3 KiB)
image.png (10.1 KiB)
image.png (5.8 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

While in some cases the content is extracted directly, I believe in your scenario, you must use the `base64()` function.


1 Vote 1 ·

1 Answer

ErshadNozari-6158 avatar image
1 Vote"
ErshadNozari-6158 answered

@PramodValavala-MSFT Thanks for response. I solved it by using the expression: outputs('Get_file_content_using_path')?['body']?['$content']

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.