编程语言
首页 > 编程语言> > c# – TFS REST API – 获取字段的允许值

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

作者:互联网

我需要使用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"
}

它在6月看起来像someone on the MSDN forums posted this,但我想仔细检查这是否仍然是尚未提供的东西.

解决方法:

REST API仍然不支持字段中的get allowedvalues.在以下网站上已经有此功能的UserVoice,您可以投票:

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

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

标签:c,rest,tfs,azure-devops
来源: https://codeday.me/bug/20190608/1198693.html