How to: Get WorkItems with a WIQL Query  Home
This page is specific to:.NET Framework Version:2.03.5
 
How to: Get WorkItems with a WIQL Query 

The Work Item Query Language (WIQL) allows SQL-like queries to get WorkItems. The Query returns a WorkItemCollection of all WorkItems that match the query string.

Example

The following example assumes a WorkItemStore exists by the name of workItemStore.

// Sample query string.
string wiqlQuery = "Select ID, Title from Issue where (State = 'Active') order by Title";

// Execute the query.
WorkItemCollection witCollection = workItemStore.Query(wiqlQuery);

// Show the ID and Title of each WorkItem returned from the query.
foreach (WorkItem workItem in witCollection)
{
    Console.WriteLine("ID: {0}", workItem.Id);
    Console.WriteLine("Title: {0}", workItem.Title);
}

See Also

© 2009 Microsoft Corporation. All rights reserved.   Terms of Use | Trademarks | Privacy Statement
Page view tracker
Rate the Lightweight library
x
Lightweight builds on ScriptFree (loband) by adding features you've requested: a SearchBox and default code language selection.
Do you like the SearchBox?
Do you like the tabbed code blocks?
How useful is this topic?
Tell us more.
Thanks
x
You're helping to improve MSDN Online.
Feedback
Switch View
Classic
Lightweight Beta
ScriptFree
Switch View