c# - TFS REST API - 获取字段的允许值

标签 c# rest tfs azure-devops

我需要使用 TFS 2015 REST API 获取特定工作项类型的字段(不在全局列表中)的允许值列表。我知道我可以使用 Get a work item field 获取有关字段的信息但这似乎并没有给我响应中允许的值。

{
  "name": "Iteration Path",
  "referenceName": "System.IterationPath",
  "type": "treePath",
  "readOnly": true,
  "supportedOperations": [
    {
      "referenceName": "SupportedOperations.Under",
      "name": "Under"
    },
    {
      "referenceName": "SupportedOperations.NotUnder",
      "name": "Not Under"
    },
    {
      "referenceName": "SupportedOperations.Equals",
      "name": "="
    },
    {
      "referenceName": "SupportedOperations.NotEquals",
      "name": "<>"
    },
    {
      "referenceName": "SupportedOperations.In",
      "name": "In"
    }
  ],
  "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_apis/wit/fields/System.IterationPath"
}

看起来像someone on the MSDN forums posted this回到 6 月,但我想仔细检查一下这是否仍然是不可用的。

最佳答案

REST API 仍然不支持获取字段中的允许值。下面的网站已经有此功能的 UserVoice,您可以投票:

https://visualstudio.uservoice.com/forums/121579-visual-studio-ide/suggestions/14839494-visual-studio-rest-api-support-to-fetch-the-list-o

目前,您只能使用旧的 .net API 通过获取类 FieldDefinition 的实例并引用 AllowedValues 属性来获取允许值。

关于c# - TFS REST API - 获取字段的允许值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40365899/

相关文章:

tfs - 如何在 TFS 2010 中远程创建新项目集合

c# - 为什么保存了 'in progress' 后测试结果有时还是 'passed'?

c# - 从外部文件读取连接字符串

c# - StreamReader 无法从已处置的对象中读取

c# - 如何在 WPF 应用程序中捆绑 View、ViewModel 和 DataTemplate 以便于重用?

WCF 服务方法返回 json 或 soap

java - Restful +休息服务

java - 具有多个自定义对象的 @Restcontroller 方法

c# - 从 Regex 读取捕获组也是 URL 重写规则?可能的?

c# - 如何安全地存储和设置 SmtpClient 类使用的密码?