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

m00*_*0.0 5 c# rest tfs azure-devops

我需要使用TFS 2015 REST API针对特定工作项类型的字段(不在全局列表中)获取允许值的列表。我知道我可以使用“ 获取工作项”字段来获取有关字段的信息,但这似乎并未在响应中提供允许的值。

{
  "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"
}
Run Code Online (Sandbox Code Playgroud)

看起来好像在六月在MSDN论坛上发布的某个人,但是我想再次检查这是否仍然不可用。

Cec*_*SFT 4

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属性来获取允许值。