File Corruption & Recovery

How to Fix Power Automate Creating Corrupted PDF Files in SharePoint

Nimra MalikNimra Malik Nov 3, 2026 870 views

Question details

Users experience corrupted or invalid PDF files when using a Power Automate flow to upload or create documents in a SharePoint folder.

How to Fix Power Automate Creating Corrupted PDF Files in SharePoint
Product
Power Automate and SharePoint
Device & OS
not provided
Scenario
A user is running a Power Automate flow that automatically creates a new SharePoint folder and attempts to upload a PDF file into it.
Observed behavior
The resulting uploaded PDF file either lacks the correct '.pdf' extension or has invalid, corrupt content, making it impossible to open or read in a PDF viewer.
Before you start

Check your Power Automate flow run history to verify that the source file is not empty or corrupted before it reaches the SharePoint upload action.

Solution 1Recommended

Configure Compose Actions for Correct File Name and ContentBytes

Use specific Compose actions to accurately extract the file name with its extension and the binary content bytes, preventing data corruption during file creation.

Many PDF corruption issues in Power Automate stem from the 'Create file' action receiving base64 encoded strings instead of raw binary data, or missing the explicit file extension in the name property.

1
Extract the file name

In your flow, add a 'Compose' action before the SharePoint step. Use an expression like string(triggerBody()?['file_1']?['name']) to capture the exact file name. Ensure this output includes the '.pdf' extension.

2
Extract the file content bytes

Add a second 'Compose' action to capture the raw binary data. Use an expression such as string(triggerBody()?['file_1']?['contentBytes']) to ensure the file contents are formatted correctly for SharePoint.

3
Update the SharePoint Create file action

In the SharePoint 'Create file' action, map the 'File Name' field to the output of your first Compose action, and map the 'File Content' field to the output of your second Compose action.

Configure Compose Actions for Correct File Name and ContentBytes
Dynamic Content Verification: Hover over your dynamic content in the flow builder to double-check that the formulas are correctly targeting the actual names of your trigger outputs.
Free Microsoft Office alternative

Manage and Verify PDF Documents Easily with WPS Office

While troubleshooting automated workflows in SharePoint, you may need a reliable desktop tool to open, verify, or edit PDF files. WPS Office offers a comprehensive, free alternative for handling PDFs and all standard office document formats seamlessly.

  1. 1. Download and Install WPS Office: Get the free WPS Office suite from the official website and install it on your computer.
  2. 2. Open the downloaded SharePoint PDF: Launch WPS PDF, click 'Open', and select the downloaded file from your SharePoint library to check its integrity.
  3. 3. Edit or Convert as needed: Use the built-in PDF tools to repair formatting, add annotations, or convert the document to Word format if necessary.
Fully compatible with Microsoft Office formats (Word, Excel, PowerPoint) and standard PDF files.Built-in robust PDF editor allowing you to read, annotate, edit, and convert PDF documents with ease.Lightweight installation and intuitive interface for quick document verification and workflow troubleshooting.
microsoft office alternative - wps office

Frequently Asked Questions

Why do my PDFs created by Power Automate have no file extension?

This happens when the file name variable passed to the SharePoint 'Create file' action does not explicitly include the '.pdf' string at the end. You must ensure the dynamic content or manual input for the file name includes the proper extension.

What does the 'contentBytes' expression do in Power Automate?

The 'contentBytes' parameter specifically extracts the raw binary data of the file rather than a standard base64 encoded string. Passing the raw binary data is necessary to generate a valid, readable PDF file in SharePoint.

Can I repair a corrupted PDF that was already uploaded by a failed flow?

Generally, if a PDF is created with missing or altered binary content during a flow upload, the data is permanently lost and the file cannot be repaired. You must correct the Power Automate flow to preserve the raw binary data and run the upload process again using the original source file.