0

I am trying to update work item in Azure devops using this API : https://learn.microsoft.com/en-us/rest/api/azure/devops/wit/work%20items/update?view=azure-devops-rest-5.1#update-a-field . But i can't find the way to do this.

  • Hi JMAL AHMED, just checking to see if the information provided was helpful. If my reply helped or gave a right direction. Appreciate for [marking it as an answer](https://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work) which will also help others in the community. – PatrickLu-MSFT May 26 '20 at 09:25

1 Answers1

1

You should use http client to call Rest API. Sample code as below:

private readonly WorkItemTrackingHttpClient _workItemTrackingHttpClient;
public RestApi(string baseUrl, string pat)
{
    var vssConnection = new VssConnection(new Uri(baseUrl), new VssBasicCredential(string.Empty, pat));

    _workItemTrackingHttpClient = vssConnection.GetClient<WorkItemTrackingHttpClient>();

    var document = new JsonPatchDocument();
    document.Add(new JsonPatchOperation()
    {
        Operation = Operation.Add,
        Path = "/fields/Microsoft.VSTS.Scheduling.Effort",
        Value = 1
    });

    var workItem = _workItemTrackingHttpClient.UpdateWorkItemAsync(document, 233843).Result;
}

Besides, you could also use client API, details you could take a look at our official doc here-- Fetch work items with queries programmatically in Azure DevOps Services

PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62