CinemaFX
CinemaFX

Reputation: 1

Power Automate Flow Uploads Corrupted Files (4 Bytes) to SharePoint After Working Properly Initially

I've built a Power Automate flow to handle email attachments by saving them to SharePoint and generating a shareable link. Initially, it worked as expected, saving attachments with full content to SharePoint. Recently, however, attachments are saved as corrupted files with only 4 bytes.

Trigger: "When a new email arrives (V3)"

Process: Retrieves attachments, saves them to SharePoint under /OriginalAttachments, and generates a share link.

(See Photo 1) Using the contentBytes expression for the "File Content" parameter.

Attachments are saved as corrupted 4-byte files, and when tried to access the file:

(See Photo 2) showing "Unable to preview file" in SharePoint.

Older files (those that were saved when the flow worked correctly) retain their original sizes.

(See Photo 3) Red shown now 4 bytes file uploaded, but same one previously was uploaded correctly

Testing Other Flows: Recreated the flow in a premium account where it worked initially, but the issue eventually appeared there too.

Checked contentBytes Output: In corrupted flows, contentBytes returns null.

(See Photo 4) body:null showing instead of content bytes

In correctly working flows, contentBytes returns base64 content as expected.

(See Photo 5) when working correctly, body isn't null

Corrupted flow outputs: {...}

(See Photo 6) Compose output for content bytes

Correct flow outputs: {base64 content...}

(See Photo 7) enter image description here

Tried using contentId, attachmentId, and other attachment properties, but files still save as 4 bytes.

  1. Why might contentBytes return null intermittently with the same file and flow configuration?

  2. Are there any specific settings or account limitations that could lead to attachments being saved as 4-byte corrupted files?

  3. What recommended fixes can ensure attachments save with their full content in SharePoint consistently?

Upvotes: 0

Views: 289

Answers (1)

user28454441
user28454441

Reputation: 1

I've found that running test flows "Automatically" causes this issue (even if previous dependent "Manually" run test flow works OK) ... whereas a fresh "Manually" test flow with the PDF/etc attached to email (i.e. not DragDrop) works.

Upvotes: 0

Related Questions