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 / Power Automate - Share...
Power Automate
Suggested Answer

Power Automate - SharePoint attachments become corrupted when sending as Outlook email attachments

(0) ShareShare
ReportReport
Posted on by 6
Hi everyone,
I’m trying to automate a process that my team currently does manually.
Scenario
We receive a notification email in Outlook whenever a new request is submitted to the sharepoint. The request and all of its supporting documents are stored in a SharePoint list as attachments.
To make sure we always have a complete backup in Outlook, I want Power Automate to automatically reply to the original notification email and attach all of the files stored in the corresponding SharePoint list item.
The flow works as follows:
  • A SharePoint item is created.
  • The flow finds the corresponding Outlook notification.
  • It gets all SharePoint attachments using Get attachments.
  • It retrieves each file using Get attachment content.
  • The attachments are added to an array variable.
  • Finally, the flow replies (or sends an email) with those attachments.
The email is sent successfully.
The attachment names and file sizes appear to be correct in Outlook.
However, every attached file is corrupted. Word, Excel, PDF, and other files cannot be opened, even though the original files in SharePoint open without any problems.
I’ve verified that:
  • The flow completes successfully with no errors.
  • The attachments are found correctly.
  • The issue only happens after the files are attached to the Outlook email.

What I’ve already checked

  • The attachments are retrieved successfully from SharePoint.
  • The flow completes without any errors.
  • The attachment names are correct.
  • Different file types all have the same problem.
  • The files only become corrupted after they are attached to the Outlook email.
Has anyone experienced this before? I’ve attached screenshots of my flow. 
Any suggestions would be greatly appreciated.
Thank you!
flow.jpg

Your file is currently under scan for potential threats. Please wait while we review it for any viruses or malicious content.

Categories:
I have the same question (0)
  • Suggested answer
    Tomac Profile Picture
    4,153 Moderator on at
     
    What format for the attachments array are you using? There is a known issue on the official documentation page (scroll down to the screenshots to see this part), you may need to use the new attachments array format:
    {
    "Name": @{items('Apply_to_each')?['DisplayName']},
    "ContentBytes": {
    "$content": @{outputs('Get_attachment_content')?['body']?['$content']},
    "$content-type": @{outputs('Get_attachment_content')?['body']?['$content-type']}
    }
    }
     
    Note that you'll need to change the dynamic content in the above example to match your flow.
     
    If that still doesn't work, you'll need to use the base64() function on the file content before adding it to the attachments array. Sometimes the files come in from Sharepoint with the wrong encoding.
  • EA-29061759-0 Profile Picture
    6 on at
    Hi Tomac,

    Thank you for your response.

    Here is more detail about my flow and the issue:

    My scenario is that we receive an intake notification email in a shared Outlook mailbox. The intake number is in the email subject. The related files are stored as attachments in a SharePoint list item with the same intake number.

    The purpose of the flow is to:
    1. Find the SharePoint item using the intake number.
    2. Get all attachments from that SharePoint item.
    3. Get the attachment content.
    4. Build an attachments array.
    5. Send one backup email to the same shared Outlook mailbox with those SharePoint attachments attached.

    The flow is able to find the correct SharePoint item and the correct attachments. The email is also sent successfully, and the files appear as attachments in Outlook. However, when we open the files from the email, they are corrupted and cannot be opened. The original files in SharePoint open correctly, so the issue seems to happen when I build the attachments array or pass the file content to the Outlook email action.

    Currently, I am using:
    - SharePoint: Get attachments
    - SharePoint: Get attachment content
    - Append to array variable
    - Outlook: Send an email

    In the “Append to array variable” action, I am using this type of structure:

    {
    "Name": items('Apply_to_each')?['DisplayName'],
    "ContentBytes": body('Get_attachment_content')
    }

    Based on your suggestion, it looks like I may need to change it to the new format, for example:

    {
    "Name": items('Apply_to_each')?['DisplayName'],
    "ContentBytes": {
    "$content": outputs('Get_attachment_content')?['body']?['$content'],
    "$content-type": outputs('Get_attachment_content')?['body']?['$content-type']
    }
    }

    Could you please confirm if this is the correct format for SharePoint list attachments?

    Also, should I use the $content value directly, or should I wrap it with base64() before adding it to the attachments array?

    For example, should ContentBytes be:

    outputs('Get_attachment_content')?['body']?['$content']

    or:

    base64(outputs('Get_attachment_content')?['body']?['$content'])

    I can also share screenshots of my Get attachments, Get attachment content, Append to array variable, and Send an email actions if that helps.

    Thank you again for your help.
  • EA-29061759-0 Profile Picture
    6 on at
    Hi Tomac,
    Thank you for your suggestion.
    I'm using the new Power Automate designer.
    When I paste the JSON object into the Append to array variable Value field, it returns "Enter a valid JSON."
    Could you please clarify exactly where this new attachments object should be added?
    Should it be entered directly in the Value field of Append to array variable, or should it be constructed another way in the new designer?
    If possible, could you share a screenshot of how this should look in the new Power Automate designer?
    error.jpg

    Your file is currently under scan for potential threats. Please wait while we review it for any viruses or malicious content.

  • EA-29061759-0 Profile Picture
    6 on at
    Hi @Tomac , Thank you so much for your help, I finally got the flow working correctly. I really appreciate the time you took to help me figure it out. 
     
    Thanks again, 
    Elnaz 
     
     
     
     

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 377

#2
11manish Profile Picture

11manish 279

#3
David_MA Profile Picture

David_MA 234 Super User 2026 Season 1

Last 30 days Overall leaderboard