5

I'm trying to get an Outlook attachment uploaded to VSTS (using the Send an HTTP request to VSTS action). I have everything else working. Including added the attachment to the ticket, but the "uploaded" file is nothing. I've tried every combination of expression to convert the attachment content, no luck. I'm sure I'm just missing some intermediary step.

Here's the "Create Attachment" step I'm using to upload the image before updating the Work item. (The Content in the Body field was just one attempt. From the linked Outlook attachment doc, its type is "byte".) enter image description here

And here's the work item, with said attachment, but there is no file content. enter image description here

Any help or suggestions are welcome.

Community
  • 1
  • 1
Tony Karel
  • 176
  • 1
  • 10
  • The size should not be 0K. I suspect that you missed "attributes" property in the request body when link the attachment to the workitem. – Eddie Chen - MSFT Jun 14 '18 at 08:36
  • 1
    @EddieChen-MSFT Adding the "attributes" property solved the file size issue, but I still cannot save the outlook attachment as the actual type of file it is. For example, I'm testing with a `.jpg` file, but after creating the attachment in VSTS it's just a txt file with the base64 string content and a .jpg extension. – Tony Karel Jun 18 '18 at 18:43
  • That's related to Flow part. If you check the input from Flow, you can see that it is sending base64 string to VSTS. – Eddie Chen - MSFT Jun 19 '18 at 01:57

1 Answers1

-1

You could check VSTS rest api of Uploads an attachment here:

POST https://{accountName}.visualstudio.com/{project}/_apis/wit/attachments?fileName={fileName}&uploadType={uploadType}&areaPath={areaPath}&api-version=4.1

If you want to upload a text file, the api is as below:

POST https://fabrikam.visualstudio.com/_apis/wit/attachments?fileName=textAsFileAttachment.txt&api-version=4.1

"User text content to upload"
Cece Dong - MSFT
  • 29,631
  • 1
  • 24
  • 39
  • That is what I'm doing, I can post to the endpoint fine. The issue is that I cannot translate the file from the outlook attachment trigger output to a format that the VSTS endpoint will use to correctly create the file. The attachments can be of any type. Look at the two links I have in my question. It's more of a Flow question than a VSTS API question. – Tony Karel Jun 08 '18 at 15:12
  • 1
    I have exactly the same issue which I am struggling from past 3 weeks. Couldn't get the attachment working. Any input will be really appreciated. Thanks in advance. – Manohar Don Mar 25 '19 at 03:14