Quickly generate Work Item Query for use in the TFS API

Quickly generate Work Item Query for use in the TFS API

Some time ago I responded to a question on StackOverflow regarding a couple of ways to optimize a team query. The query was used in from the TFS Client Object Model and one of the things that was clear from the way the original code was formatted, was that the original poster had had some issues piecing the query together.

So if you're ever having to write a Work Item Query for the API, use the following trick to make your life easier. Create a new query inside Visual Studio or edit an existing one. Use the File->Save Selected Item As...

Save the query to a place you can find it quickly, such as your Documents folder:

Then open the wiq file in Notepad and extract the generated query: