vpi
vpi

Reputation: 193

How to retrieve the TFS queries of a user?

Similar to this question : How can I retrieve a list of workitems from TFS in C#?

But I am trying to retrieve the queries (not workitems) of the user (to call them later, but that's another topic). Is it possible to do that with C# ?

Also, related, is there any documentation anywhere about the tables that are used in the WorkItemStore.Query object ?

Sorry if this has been asked before, but googling with TFS and queries returns a lot of unwanted results (obviously).

Thanks !

Upvotes: 1

Views: 238

Answers (1)

vpi
vpi

Reputation: 193

Aaaaaaaaaaaand, looking 5 minutes into the namespace would have saved me from writing yet another useless SO question. Answer if anyone is ever interested :

TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(new Uri("Uri"));
tfs.EnsureAuthenticated();

WorkItemStore workitemstore = tfs.GetService<WorkItemStore>();
QueryHierarchyProvider queryProvider = new QueryHierarchyProvider(workitemstore);
Project project = workitemstore.Projects["MyProject"];
var queries = queryProvider.GetQueryHierarchy(project);

Upvotes: 2

Related Questions