Shipu
Shipu

Reputation: 563

Query multiple project workitem in a single call using tfs api

Is it possible to query the workitems of 2 different projects in the DefaultCollection with a single call. If so, how?

Upvotes: 1

Views: 868

Answers (1)

DaveShaw
DaveShaw

Reputation: 52798

You can do it be creating a WIQL query using the IN operator and listing the Team Projects you're interested in.

For example:

var wiql = @"SELECT * 
             FROM WorkItems 
             WHERE [System.TeamProject] IN ('Project1', 'Project2')";

using (var tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(uri)
{
    tfs.EnsureAuthenticated();
    var store= tfs.GetService<WorkItemStore>();
    var workItems = store.Query(wiql);
}

Upvotes: 3

Related Questions