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

Notifications

Announcements

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!

 
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,865 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,865 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
    12,982 Super User 2025 Season 2 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,865 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard