Deepak Jain
Deepak Jain

Reputation: 137

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

Upvotes: 1

Views: 720

Answers (1)

PatrickLu-MSFT
PatrickLu-MSFT

Reputation: 51083

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

Upvotes: 3

Related Questions