简体   繁体   English

使用 Asp.net 更新单个工作项 Azure Devops

[英]Updates a single work item Azure Devops using Asp.net

I am trying to update work item in Azure devops using this API: https://docs.microsoft.com/en-us/rest/api/azure/devops/wit/work%20items/update?view=azure-devops-rest-5.1#update-a-field . I am trying to update work item in Azure devops using this API: https://docs.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.但我找不到这样做的方法。

You should use http client to call Rest API.您应该使用 http 客户端调用 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此外,您还可以使用客户端 API,详细信息您可以在此处查看我们的官方文档——在 Azure DevOps Services 中以编程方式获取带有查询的工作项

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Azure DevOps 使用 API 获取工作项通知 - Azure DevOps Get work item notification using API 如何在单个应用程序中处理多个域? ASP.net 核心 3.0(剃须刀页面,天蓝色) - How to work with mulitple domains in a single app? ASP.net core 3.0 (razor pages, azure) 对listview的单个项目不可见的listview itemtemplate模板项 - invisible a listview itemtemplate item for a single item of a listview asp.net AcquireTokenByAuthorizationCode 在使用 ASP.NET MVC 使用 Azure Active Directory 的单租户应用程序中引发新异常 - AcquireTokenByAuthorizationCode throw new exception in single tenant application using ASP.NET MVC using Azure Active Directory 使用SAML 2.0协议和ASP.NET C#的Azure单一登录 - Azure Single Sign-On using SAML 2.0 Protocol and ASP.NET C# 使用 C# ASP.NET MVC 显示来自单个数组 JSON(azure Cosmos db) 的数据 - Display data from single array JSON(azure Cosmos db) using C# ASP.NET MVC 使用SignalR和SqlDependency的ASP.Net MVC 4中的数据库更改更新 - Database change updates in ASP.Net MVC 4 using SignalR and SqlDependency 在 Azure Functions 中使用 ASP.NET 标识 - Using ASP.NET Identity in Azure Functions ASP.NET Core 3.1 API 参考 a.Net Standard class 库 - 在 Azure DevOps 中构建失败 - ASP.NET Core 3.1 API referring to a .Net Standard class library - build failed in Azure DevOps ASP.net MVC5-For循环发布单个项目,但不发布集合 - ASP.net MVC5 - For loop posts single item but not the collection
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM