Sachi Sachi - 1 month ago 13
reST (reStructuredText) Question

TFS REST API - Get allowed values of field

I need to get the list of allowed values in a field (that aren't in a global list) using the TFS 2015 REST API for a particular work item type. I know that I can get information about a field with Get a work item field but that doesn't seem to give me the allowed values in the response.

{
"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"
}


It looks like someone on the MSDN forums posted this back in June, but I want to double-check if this is still something that isn't yet available.

Answer

REST API still doesn't support get allowedvalues in a field. There is already a UserVoice for this feature at website below, you can vote it:

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

Currently, you can only use old .net API to get allowedvalues by getting an instance of class FieldDefinition and referencing the AllowedValues property.