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 / Azure DevOps - email w...
Power Automate
Suggested Answer

Azure DevOps - email with Attachments

(1) ShareShare
ReportReport
Posted on by 35

Hello,

 

I'm building a flow that will create tickets in Azure DevOps based on the content of the received email and experiencing an issue with email attachments when attempting to add them to tickets. Although the files are successfully attached to the tickets, they are marked as corrupted and cannot be opened. This problem affects various types of attachments, and users are unable to access the content of these files. 

 

Has anyone faced a similar issue? 

Thanks!

 
Problem1 (1).png
Categories:
I have the same question (0)
  • Suggested answer
    AnthonyAmador Profile Picture
    2,553 Moderator on at
    Hi, 
     
    If my understanding is correct, the ‘attachment content’ is of the byte data type. You have the option to either modify your request to use the byte data type or convert the attachment to Base64 by using base64().

    base64(body('Get_Attachment_(V2)')?['contentBytes'])

    Let me know if that works.
    Anthony. 

    If my reply answers your question, please like and mark it as verified. This helps me stay motivated to assist others and makes it easier for users with similar questions to find the answer. Thanks!
    Feel free to connect with me on LinkedIn!
     
     
  • alexandrama Profile Picture
    35 on at
    Hello, I've tried this but it doesn't seem to work! Have you got any other idea?
  • Suggested answer
    abm abm Profile Picture
    32,985 Most Valuable Professional on at
    Hi
     
     
    Created a video based on this a while ago.
     
     
     
    Change the version from 6.0 to 5.0

    /_apis/wit/attachments?filename=@{items('Apply_to_each')?['name']}&api-version=5.1

    Then under the body use expression
    binary('here map the email attachment content bytes')
    Set the Body is Base64 to Yes
     
    Let me know how it goes.
     
    Thanks
  • alexandrama Profile Picture
    35 on at
    Hello, I've tried this idea but I get an error, do you have any idea why?
     
     
     
     
  • abm abm Profile Picture
    32,985 Most Valuable Professional on at
    Hi
     
    Change the version to 5.0 and try. Let  me know the results.
     
    Thanks
  • Suggested answer
    David_MA Profile Picture
    14,085 Super User 2026 Season 1 on at
    I followed this video recently and it worked for me: https://youtu.be/Ivdj6Gf_K-M?si=-jUCipPksqBw7kLj. Note, you do need to follow it exactly, including the portions to generate a failed flow. Note, for what I did was to get the attachments from a MS Form submission, and I had to slightly modify the process. But since you are getting the attachments from e-mail, you should be all set since that is what is used in the demo. As abm abm noted, I used version 5.0 of the API as well to get it to work.

    I think abm abm is the author of the above video. If so, thank you so much for creating it! It is odd that you need a failure of the flow to get this to work. So many people would have just given up.
  • Suggested answer
    abm abm Profile Picture
    32,985 Most Valuable Professional on at
    Hi 
     
    I tried with version 6.0 and worked as expected. Here are the steps:
     
     
     

     
    Action Step: Send an HTTP request to Azure DEVOPS
     
    POST
     
    /_apis/wit/attachments?filename=@{items('Apply_to_each')?['name']}&api-version=6.0
     
    Content-Type
     
    application/octent-stream
     
    Action Step: Send an HTTP request to Azure DEVOPS2
     
    PATCH
     
    /_apis/wit/workitems/@{outputs('Create_a_work_item')?['body/id']}/?api-version=6.0
     
     
    Content-Type
     
    application/json-patch+json

    [
    {
    'op': 'add',
    'path': '/relations/-',
    'value': {
    'rel': 'AttachedFile',
    'url': '@{body('Parse_JSON')?['url']}',
    'attributes': {
    'comment': 'Bug details',
    'name':'@{items('Apply_to_each')?['name']}'
    }
    }
    }
    ]
     
     
    Here is my video which is using version 5.1
     

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 March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 589

#2
Valantis Profile Picture

Valantis 328

#3
David_MA Profile Picture

David_MA 284 Super User 2026 Season 1

Last 30 days Overall leaderboard