Search code examples
azure-devopsazure-devops-rest-apiazure-rest-api

Find Attachments in Azure DevOps REST API for deletion


When I submit an Attachment to the Azure DevOps REST service (create), is there a place I can go to visualise all of the attachments in there? Or is my best course of action to just send a GET which will give me the list?

My problem then becomes...that there is no way for me to delete unwanted attachments.


Solution

  • Is there a place I can go to visualise all of the attachments in there? Or is my best course of action to just send a GET which will give me the list?

    Yes, the best course of action to view these attachments is to send a GET request.

    In fact, after you upload the attachments to a work item via the API, all of them are managed by the backend. The backend does not assign any relevant info to the work item. This leads to the situation where you cannot view them from the UI, unfortunately.

    Microsoft hasn't expanded the API/SDK to provide an "attachment delete" call yet.

    You can also press F12, then try with uploading and deleting attachments from one workitem within the UI.

    enter image description here

    As you can see, the attachments deleted are run by the backend via sending an event call. In your scenario, you cannot remove those unwanted attachments until now.

    You are not the first one who has requested this feature. See this suggestion: Unable to delete/remove attachment from work item by using VSTS api. You can vote and comment there to raise its priority. The product team can then consider adding the feature to the roadmap.