Chris Cooper
Chris Cooper

Reputation: 389

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?

enter image description here

Upvotes: 0

Views: 509

Answers (1)

Eddie Chen - MSFT
Eddie Chen - MSFT

Reputation: 29958

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("]");

Upvotes: 2

Related Questions