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 Attachments uplo...
Power Automate
Suggested Answer

Email Attachments uploaded to ADO Work Item are getting Corrupted / Blank via Power Automate

(1) ShareShare
ReportReport
Posted on by 3

Hello Power Platform Community,

 

I'm facing an issue while using Power Automate to upload email attachments from Outlook into an Azure DevOps work item.

 

Scenario:-

 

My flow currently does the following:

  1. Triggers when a new email arrives.
  2. Retrieves attachments using Get Attachment (V2).
  3. Uploads the attachment to Azure DevOps Work Item using the Send an HTTP request to Azure DevOps (POST: "https://dev.azure.com/{organization}/{project}/_apis/wit/attachments?fileName=file.zip&api-version=…)
  4. Updates the work item with the uploaded attachment URL using Send an HTTP request to Azure DevOps (PATCH: https://dev.azure.com/{organization}/{project}/_apis/wit/workitems/{id}?api-version=7.1)

 

Issue:

 

The attachment upload is succeeding, and the file is getting attached to the Azure DevOps work item. However, the attached files appear to be corrupted / blank when opened from Azure DevOps.

 

For example:

  • PDF files open with the correct number of pages but the pages are blank.
  • in some cases, files appear empty or unusable. 
  • Also it seems that any .msg attachments are totally skipped by Power Automate. It is not considering the .msg files as attachments.

What I have already tried

I tested multiple approaches in Power Automate, including:

  • Using Get Attachment (V2) output directly
  • Using Compose with:
    • base64ToBinary(...)
  • Setting the Azure DevOps upload request header to:
    • Content-Type: application/octet-stream
  • Ensuring the attachment is later added to the work item using the returned attachment URL

 

Do you know or have already a working solution where the email attachments could be successfully attached to ADO Work Items?

 

Any sort of guidance would be much appreciated 🙂 

 

Regards,

Soumik

Categories:
I have the same question (0)
  • Suggested answer
    Sunil Kumar Pashikanti Profile Picture
    2,088 Moderator on at
     
    Even though you tried Get Attachment (V2), base64ToBinary(), and Content-Type: application/octet-stream, the issue is that Azure DevOps requires pure binary in the POST upload body, not JSON and not encoded content. The Outlook “Get Attachment (V2)” action does not return true raw binary and often corrupts files (PDF, ZIP, images, etc.).

    To fix this:
    Use Get Email (V3) → Include Attachments = Yes
    For each attachment, pass the ContentBytes directly as the raw HTTP body:
         @{base64ToBinary(items('Apply_to_each')?['ContentBytes'])}
         (No JSON, no quotes, no wrapping.)
    Set on the POST upload step:
         Content-Type: application/octet-stream
         Content-Length: <length of binary>
    Use the returned URL to PATCH the work item.
     
    This combination produces valid, non‑corrupted attachments.
    Note: .msg files are never returned as attachments, so they cannot be uploaded using this method.
     
    Only .eml files are reliably exposed, .msg files need to be converted or forwarded differently (Outlook API or Graph)
    .eml vs .msg
    Format Used by Notes
    .eml Most email systems (Outlook, Gmail, Thunderbird, Apple Mail) Open standard MIME format
    .msg Microsoft Outlook only Proprietary Microsoft format
     
     
    Why .eml works in Power Automate (but .msg doesn't)?
    Power Automaet’s Outlook connectors parse emails using MIME standards.
    Since .eml follows MIME, it appears as an attachment with proper ContentBytes.
    But .msg is Microsoft‑proprietary, so Flow usually skips it.
     
    That means, you have to make suer that the instead of attaching .msg file you need to attach it as .eml file or convert the .msg file to .eml file. There are various methods to do this.
     
     
     
    ✅ If this answer helped resolve your issue, please mark it as Accepted so it can help others with the same problem.
    👍 Feel free to Like the post if you found it useful.
     

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 1,005

#2
Valantis Profile Picture

Valantis 825

#3
Haque Profile Picture

Haque 619

Last 30 days Overall leaderboard