Upload PDF Attachments to Store in Share point (Base64)

Upload Pdf Attachments to Store in SharePoint from Canvas App Using Power Automate Workflow.

High level resolution steps

  • Create a Power Automate workflow to upload and store the PDF.
  • Create a Canvas App

Detailed resolution steps

Step 1: Create Power automation workflow to store in SharePoint.

i. Create an Instant flow and Select the Trigger “When Power Apps Calls a flow(V2)”

ii. Select the user input File “File Content” and add “+New Step” and Select the Operation “Compose”. And Give Site Address and Folder Path (SharePoint Folder Path).

iii. Give Expression in the file name: @{triggerBody()[‘file’][‘name’]}
iv. Give Expression in the File Content: @{triggerBody()[‘file’][‘contentBytes’]}
v. Save the Flow “pdfupload”

The Entire Pdfupload flow looks like this

Step2: Create a Canvas app and insert an “Attachments control” and a “PDF Viewer” using a “Base64 flow”. You can refer to this webinar for guidance. “Convert uploaded file into base64 and view it as well”

Step 3: To store the uploaded PDF, use the ‘OnAdd File’ property of the “Attachment Control” and provide the code to run the flow.

pdfupload.Run({file:{contentBytes:Last(Self.Attachments).Value,name:Last(Self.Attachments).Name}})

Step 4: When you use the app to attach any file, it will be stored in the Specified Folder

Output:

  • Showing the result of Attached PDF File and It Stored in the Share point Folder.