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

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Copy attachments between items in DevOps

(0) ShareShare
ReportReport
Posted on by 4

Hi there.

 

I had a flow that when the user fills a "New Demand Request" (a new item I created in DevOps, like a little interview between P.O. and user), the flow create a User Story using what has been inputed by the user in a template description.

 

But, I can't figure out how to transfer the attachments that user eventually upload in "New Demand Request" to the "User Story" using the flow. I had tried some ways to see if I can get this exposed through DevOps actions and triggers, but with no lucky.

 

So I need help. Is there anyone that gone through this problem and found a solution?

 

I have the same question (0)
  • Expiscornovus Profile Picture
    32,908 Most Valuable Professional on at
    Re: Copy attachments between items in DevOps

    Hi @jg_lopes,

     

    This should be possible by using the Send an http request to Azure DevOps and Get Attachment method from the Azure DevOps Rest API:

    https://docs.microsoft.com/en-us/rest/api/azure/devops/wit/attachments/get?view=azure-devops-rest-6.0

     

    attachments.png

  • Verified answer
    Expiscornovus Profile Picture
    32,908 Most Valuable Professional on at
    Re: Copy attachments between items in DevOps

    For the upload part you can follow the steps from this blog. From the Post the Attachment to DevOps REST API part. I have tested it myself and it works pretty good:

    https://www.fidelityfactory.com/blog/2019/10/14/use-ms-flow-to-add-an-attachment-in-azure-dev-ops

     

    To demonstrate that example I have tested all the steps.

     

    1. Get the source Work Itemgetworkitem.png

     

    2. Get attachment of source Work Item

    getattachment.png

    3. Upload attachment as new attachment. The body is the output of step two.

    uploadattachment.png

    4. Create new work item with new attachment as related item. Below is a sample body for this request. Don't forget that the content-type for this request is a bit different. Btw, you could also parse the json of step 3 to extract the attachment url.

    [
     {
     "op": "add",
     "path": "/fields/System.Title",
     "value": "Test Title"
     },
     {
     "op": "add",
     "path": "/relations/-",
     "value": {
     "rel": "AttachedFile",
     "url": "yourattachmentfileurlfromstep3",
     "attributes": {
     "comment": "Test Comment"
     }
     }
     }
    ]

     

    createworkitem.png

  • jg_lopes Profile Picture
    4 on at
    Re: Copy attachments between items in DevOps

    Thanks @Expiscornovus !

     

    Works like a charm. I'd obviously to made some changes to work in my flow, but at the end this post had clarify for me some concepts behind Power Automate and made me study more the Azure APIs.

     

    So, I made a mix between "Create a item" and use of some GET, POST and PATCH through "send a http request", but at the end of the day, everything works!

     

    Regards,

     

    Juliano

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 659 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 386 Moderator

#3
chiaraalina Profile Picture

chiaraalina 290

Last 30 days Overall leaderboard