Essentials of Work Item Queries
You can use the work item object model to construct SQL-like query statements in the Work Item Query Language (WIQL). WIQL can select work items assigned to a particular person, work items that contain specific title words, or work items that fulfill other criteria.
The power of the work item store comes from the ability to query its contents. You can use it to build more complex queries than are supported in the query builder user interface found in the Team Explorer.
These queries can be run against a WorkItemStore in several ways.
You can call the query and pass it a string containing your query:
You can call all the queries and pass it a string containing your query context. The context contains information such as dayprecision.
public Query(WorkItemStore store, string wiql) public Query(WorkItemStore store, string wiql, IDictionary context)
Queries against the WorkItemStore can take a significant amount of time to complete. You can run them and then cancel them asynchronously using query methods such as these:
public Microsoft.TeamFoundation.Client.ICancelableAsyncResult BeginQuery() public Microsoft.TeamFoundation.Client.ICancelableAsyncResult BeginQuery(System.AsyncCallback callBack) public Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemCollection EndQuery(Microsoft.TeamFoundation.Client.ICancelableAsyncResult car)
Queries can be persisted on the Team Foundation Server using the StoredQueryCollection class. After it is saved, the query appears in the Team Explorer. Other team members can then edit and run the query.