c# - 在 Devops 中查找自定义字段的路径
问题描述
我正在构建一个控制台应用程序,它以编程方式在 Azure DevOps 中创建工作项。到目前为止,我已经成功地将值设置为预定字段。例如,通过执行以下代码
`
Uri uri = new Uri(_uri);
string personalAccessToken = _personalAccessTocken;
string project = _project;
// Creating credentials using PAT
VssBasicCredential credentials = new VssBasicCredential(string.Empty, _personalAccessTocken);
JsonPatchDocument patchDocument = new JsonPatchDocument();
//add fields and their values to the patch document
// See this link below to find out the path of Work Item Field:
// https://docs.microsoft.com/en-us/azure/devops/boards/work-items/guidance/work-item-field?view=azure-devops
patchDocument.Add(new JsonPatchOperation()
{
Operation = Operation.Add,
Path = "/fields/System.Title",
Value = "Test - Please Ignore"
}`
在这里,设置值是成功的,因为我可以在 Microsoft 文档中找到 Title 字段 (/fields/System.Title) 的路径
但是,我遇到了一个名为Errormsgtag的客户创建的自定义字段,由于缺少路径,我无法为其设置值。
问题是:如何找到自定义字段的路径?Microsoft 是否有任何预先确定的规则?
提前致谢
解决方案
有一个休息 api,您可以在其中通过名称请求 WorkItemField,然后您可以使用带有 ID 的 workitemfielddefinition -> https://docs.microsoft.com/en-us/rest/api/azure/devops /wit/fields/get?view=azure-devops-rest-5.0
我认为客户端 dll 已经包装了这个功能,但我必须查找在哪里......
推荐阅读
- python - 在 while 循环或类似循环中重复命令,直到找到不存在的结果
- html - 我无法以 ngb 模态 Angular 7 提交角度反应形式
- flutter - 在文本小部件中添加指向导航器的链接
- python - TypeError:“ndarray”类型的对象不是 JSON 可序列化的
- java - Java 应用程序客户端因 JNIWrapper 异常而冻结
- paypal - 自适应支付流程中断
- ruby-on-rails - 当我有嵌套路由时,如何让我的 Rails api 索引操作仅显示来自某个 id 的实例?
- wordpress - 重力表单插件在 Microsoft Edge 上不起作用
- ios - 将渐变应用于按钮不会迅速反映
- jmeter - 如何存储整个加密响应,使用 POST 方法对其进行解密,并使用 Jmeter 更新下一次休息调用的响应