我需要使用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,但我想仔细检查这是否仍然是尚未提供的东西。
答案 0 :(得分:4)
REST API仍然不支持字段中的get allowedvalues。在以下网站上已有此功能的UserVoice,您可以投票:
目前,您只能通过获取类 FieldDefinition 的实例并引用 AllowedValues 属性来使用旧的.net API来获取允许值。
答案 1 :(得分:1)
据我了解,自4.1版开始支持此功能
您可以在工作项的上下文中获得给定字段的允许值列表。
示例响应如下:
{
"alwaysRequired": false,
"defaultValue": null,
"allowedValues": [
{
"displayName": "Jamal Hartnett",
"id": "df828ec3-71d8-6e69-9afd-e736c5a32145",
"uniqueName": "fabrikamfiber4@hotmail.com",
"descriptor": "s2s.M2FjODRhZmItYWIwNC00ZWM0LWEyZWItOGEyYWJmNGJlNDQ3QDcyZjk4OGJmLTg2ZjEtNCFhZi05MWFiLTJkN2NkMDExZGI0Nw"
},
{
"displayName": "Norman Paulk",
"id": "df828ec3-71d8-6e69-9afd-e736c5b32145",
"uniqueName": "Fabrikamfiber16@hotmail.com",
"descriptor": "s2s.M2FjODRhZmIeYWIwNC00ZWM0LWEyZWItOGEyYWJmNGJlNDQ3QDcyZjk4OGJmLTg2ZjEtNDFhZi05MWFiLTJkN2NkMDExZGI0Nw"
},
{
"displayName": "Chuck Reinhart",
"id": "df828ec3-71d8-6e69-9afd-g736c5a32145",
"uniqueName": "fabrikamfiber3@hotmail.com",
"descriptor": "s2s.M2FjODRhZmItYWIwNC00SWG0LWEyZWItOGEyYWJmNGJlNDQ3QDcyZjk4OGJmLTg2ZjEtNDFhZi05MWFiLTJkN2NkMDExZGI0Nw"
}
],
"dependentFields": [],
"referenceName": "System.ChangedBy",
"name": "Changed By",
"url": "https://dev.azure.com/fabrikam/_apis/wit/fields/System.ChangedBy"
}