0

I am building a Web Application using TFS API. I would like to fetch the All the range of "Priority" values from the TFS API and populate my asp.net dropdownlist. Similarly. I would like to fetch All the for `"Severity" and "Triage" and populate them into different dropdownlist.

I have an image of what I am talking about below :

enter image description here

Here is the code I have to access TFS Projects so far Can anyone let me know who I can access all the ITEMS TFS has for Priority, Severity & Triage :

Uri url = new Uri("server location");
NetworkCredential nc = new NetworkCredential(credentials, url);
TfsTeamProjectCollection coll = new TfsTeamProjectCollection(url, nc);
coll.EnsureAuthenticated();
WorkItemStore workItemStore = coll.GetService<WorkItemStore>();
Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
CodeNinja
  • 3,188
  • 19
  • 69
  • 112

1 Answers1

2

Something like

workItemStore.FieldDefinitions["Microsoft.VSTS.Common.Priority"].AllowedValues

or

var filters = new FieldFilterList();
filters.Add(new FieldFilter(CoreField.State, "New"));
workItemStore.FieldDefinitions["Microsoft.VSTS.Common.Priority"].FilteredAllowedValues(filters);

should work. Using the first or second example depends if you want all admitted values or just those admitted in a specific state; you can set even more complex filters.

Substitute Microsoft.VSTS.Common.Priority with the other fields you are interested in, the Reference names can be found here.

Giulio Vian
  • 8,248
  • 2
  • 33
  • 41