Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to find all the values of fields in WIQL TFS Workitem by C# code ?

how to find all the Values of Field such as Done status,Workitemtype and state Image attached.
workitem type fields with it's values
enter image description here
State field with all it's value's

enter image description here
Done status with it's value's
enter image description here

like image 335
Deepak Jain Avatar asked Mar 05 '18 07:03

Deepak Jain


1 Answers

Yes, you could use client API to get allowedvalues by getting an instance of class FieldDefinition and referencing the AllowedValues property.

FieldDefinition.AllowedValues Property

A sample code for your reference.

var tfs = TeamFoundationServerFactory.GetServer("http://vstspioneer:8080/tfs/VSTSDF");
var workItemStore = (WorkItemStore)tfs.GetService(typeof(WorkItemStore));
var allowedValues = workItemStore.FieldDefinitions[xxx.xxx].AllowedValues;

foreach (String value in allowedValues)
{
    Console.WriteLine(value);
}

Done status is not a build-in filed, should be a customize field.

More details please refer this blog: Get List of Allowed Values in TFS Work Item Field

like image 179
PatrickLu-MSFT Avatar answered Oct 16 '22 09:10

PatrickLu-MSFT