简体   繁体   中英

Visual Studio Team Services - Attaching an attachment to a workitem

I'm create a simple desktop application, which add work items to Visual Studio Team Services (previously Visual Studio Online). My concept application is near to completion and the last element was to send an file as an attachment. The sending work, it just the attaching of the attachment to the work item. I keep on getting Method not allowed response.

The code is simple, as I've tried to limit anything that could stop it working.

Could someone please point out what Is wrong within this picture?

在此处输入图片说明

Add attachment requires "Patch" method, try with the code below:

using Microsoft.VisualStudio.Services.WebApi;


HttpResponseMessage response = client.PatchAsync(url, content).Result;
response.EnsureSuccessStatusCode();

And you also need to add "[" and "]" in "msg":

msg.Append("[");
...
msg.Append("]");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM