Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get all work items in an iteration?

Tags:

c#

tfs

I am using TFS client side libraries, e.g Microsoft.TeamFoundation.* assemblies... Given that I have an Iteration name, how do I retrieve all the work items that belong to it?

I've tried the following using the Query object:

var uri = new Uri(ConfigurationManager.AppSettings["TfsUri"]);
var tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(uri);
var wiStore = tfs.GetService<WorkItemStore>();

var queryText = "select [System.Id], [System.WorkItemType], [System.Title], [System.AssignedTo], [System.State] from WorkItems where [System.TeamProject] = 'VieroSAT'  and [System.State] = 'Dev'  order by [System.Id]";
var query = new Query(wiStore, queryText);

but I can't figure out how to limit results by Iteration Name. And I'd much rather return these values using the TFS assemblies, but I can't find the appropriate method.

So my questions...

  1. How to return a list of all work items in an iteration, using the TFS Assemblies only (e.g. no queries).
  2. If #1 is not possible, how do I do the above but using a Query object.
like image 318
AngryHacker Avatar asked Oct 10 '13 18:10

AngryHacker


1 Answers

I don't have a quick way of testing this, but according to msdn, you can use the Under comparison operator in your query. However, I'm not sure what field you would use in that where clause to compare against the iteration name. Perhaps something like this:

select [System.Id], [System.WorkItemType], [System.Title], [System.AssignedTo], [System.State]
from WorkItems
where
  [System.TeamProject] = 'VieroSAT'
  and [System.State] = 'Dev'
  and [System.IterationPath] Under 'Iteration1'
order by [System.Id]
like image 178
vlad Avatar answered Sep 28 '22 07:09

vlad