tfs icon indicating copy to clipboard operation
tfs copied to clipboard

Allow upload Attachments to WI

Open allburov opened this issue 8 years ago • 7 comments

May be, someone needs upload attachments to WI.

wi = client.get_workitem(ids=111)
attachment= wi.attach(filename="myfilename.txt", filepath="C:\Users\allburov\myfile.txt")

allburov avatar Mar 12 '18 07:03 allburov

i am getting error: 'Workitem' object has no attribute 'attach'

is this still working?how can i add ".msg" file as attachment to WIT?

myksaquino avatar Nov 19 '18 09:11 myksaquino

@myksaquino This feature has not yet been implemented, unfortunately. You can vote +1 and if there are many who wish, one of the maintainers will develop this feature. Or you can develop it and create pull request :)

allburov avatar Nov 21 '18 03:11 allburov

we were able to read and download attachments for WIT but unable to attach to WIT...hopefully this can be added ASAP.

myksaquino avatar Nov 21 '18 07:11 myksaquino

FYI, relevant API doc: https://docs.microsoft.com/en-us/rest/api/azure/devops/wit/work%20items/update?view=azure-devops-rest-5.0#add_an_attachment

ondrno avatar Dec 30 '18 20:12 ondrno

FYI, relevant API doc: https://docs.microsoft.com/en-us/rest/api/azure/devops/wit/work%20items/update?view=azure-devops-rest-5.0#add_an_attachment

I suppose the trick is here:

   {
    "op": "add",
    "path": "/relations/-",
    "value": {
      "rel": "AttachedFile",
      "url": "https://dev.azure.com/fabrikam/_apis/wit/attachments/098a279a-60b9-40a8-868b-b7fd00c0a439?fileName=Spec.txt",
      "attributes": {
        "comment": "Spec for the work"
      }
    }

but it's unclear for me - how did they get that guid:

098a279a-60b9-40a8-868b-b7fd00c0a439

And internet says I must pass filestream to a 'fileName' parameter - then why do they pass filename + file extension there?

orihomie avatar May 03 '19 15:05 orihomie

@orihomie you're going to get it as a response from upload attachment post:

https://docs.microsoft.com/en-us/azure/devops/integrate/previous-apis/wit/attachments?view=tfs-2015#upload-an-attachment

Boltyk avatar May 03 '19 17:05 Boltyk

No update about this?

aderbas avatar May 11 '22 18:05 aderbas