I'm trying to get all different Iteration Paths of our Team Project by using a wiql query.
My actual solution is the following:
I use this query
public static readonly string IterationPathsQuery = @"SELECT [System.IterationPath] FROM workitems
WHERE[System.WorkItemType] = 'Requirement'
OR[System.WorkItemType] = 'Feature'";
To get all relevant WorkItems and iterate through them to get all the different Iteration Paths.
private void FillIterationPathComboBox(WorkItemStore wiStore)
{
WorkItemCollection wiCollection = wiStore.Query(Constants.IterationPathsQuery);
var paths = new List<string>();
...
foreach (WorkItem wi in wiCollection)
{
...
if (!String.IsNullOrEmpty(wi.IterationPath) && !paths.Contains(wi.IterationPath))
{
paths.Add(wi.IterationPath);
}
}
foreach (string path in paths)
{
IterationPathComboBox.Items.Add(path);
}
}
But this solution is not with good performance. Is there a way to query only for the different Iteration Paths that are used? I already read that "distinct" is not supported, but maybe there's a way that I did not think about yet.