web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Email Workflow Automat...
Power Automate
Answered

Email Workflow Automation Problem with Attachements which get damaged while forwarding

(0) ShareShare
ReportReport
Posted on by

Hi everyone,

I’m running into an issue with corrupted email attachments in a Power Automate flow and I can’t figure out where the encoding breaks.

Scenario

I have a cloud flow that:


  1. Triggers when a new email arrives in a shared mailbox

  2. Runs the content through a Copilot/AI agent to classify it

  3. Depending on the result, forwards/sends the email to one of two shared mailboxes

  4. Loops through the original attachments

  5. Saves each attachment to SharePoint

  6. Retrieves the file again from SharePoint

  7. Re-attaches the file to a new email using Send email from shared mailbox (V2)

Everything works functionally, but the re-attached files (PDFs and images) are corrupted

Flow details

Inside an Apply to each loop:


  1. Get attachment (V2) (Office 365 Outlook)

  2. Create file (SharePoint)

  3. Get file content (SharePoint)

  4. Append to an array variable (spAttachments)

  5. Use that array in Send email from shared mailbox (V2) → Attachments

The problem

The attachments arrive at the destination mailbox but are corrupted (PDFs cannot be opened, images are invalid).

To debug, I added a Compose action after Get file content.

The output starts with:

%PDF-1.4
%���� ReportLab Generated PDF document ...
 

So Get file content is returning raw file content (PDF structure), not Base64.

However, the Outlook "Send email (V2)" connector expects:

{
"Name": "file.pdf",
"ContentBytes": "<base64 string>"
}
 

What I already tried


  • Passing body('Get_file_content') directly → corrupted

  • Using base64(body('Get_file_content')) → still corrupted

  • Using $content property (when available) → still corrupted

  • Bypassing SharePoint and directly using:

    outputs('Get_attachment_(V2)')?['body/contentBytes'→ still corrupted
  • Building the attachment object using: addProperty(json('{}'), ...)

  • Using JSON(concat()) method

  • Using direct object syntax in the array

Flow runs successfully. No runtime errors. Attachments just arrive broken

Key observation

From Compose output:

Get file content clearly returns raw binary (PDF text structure), not Base64.

Even when converting with base64() before assigning to ContentBytes, the attachment still arrives corrupted

Questions


  1. Is there a known issue when re-attaching files retrieved via SharePoint Get file content?

  2. Should base64ToBinary() be used before saving to SharePoint and then $content retrieved?

  3. Is there a known size/encoding limitation with array variables and large Base64 strings? I just send normal seized pdfs and pictures so far

  4. Is it recommended to use Forward email (V2) instead of rebuilding attachments? - which was also not working for me... 

  5. Is there a specific way the Outlook connector expects attachment objects when using shared mailboxes?

Expected behavior

Original attachment → saved to SharePoint → retrieved → reattached → identical file.

Currently: file content is altered/corrupted somewhere in the process

If anyone has a proven pattern for:

Email attachment → SharePoint → retrieve → reattach → Send email (V2)

without corruption, I would greatly appreciate it.

 

Thanks in advance.

I have the same question (0)
  • Verified answer
    Kalathiya Profile Picture
    2,116 Super User 2026 Season 1 on at
    Hello @SR-13022228-0

    Please try this approach. I understand that you have uploaded the attachment to a document library. When you use the Get file content action, it already returns the file in Base64 format, so there is no need to encode it again.

    Please give this a try.

    {
      "ContentBytes": @{body('Get_file_content')},
      "Name": @{items('Apply_to_each_5')?['{FilenameWithExtension}']}
    }

     

    Reference blog: 

    https://automations365.com/power-automate-get-attachments-in-sharepoint-library-and-send-to-email/

    https://learn.microsoft.com/en-us/microsoft-365/community/power-automate-send-sharepoint-files-as-attachments

     

    If this response resolves your issue, please mark it as the Verified Answer so it can help other community members as well.
    ---------------------------------------------------------------------------------
     
    📩 Need more help? Mention @Kalathiya anytime!
    ✔️ Don’t forget to Accept as Solution if this guidance worked for you.
    💛 Your Like motivates me to keep helping!

     

     

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 840

#2
Valantis Profile Picture

Valantis 661

#3
Haque Profile Picture

Haque 589

Last 30 days Overall leaderboard