Default work item query for the Pending Changes window

 

There has been a couple of requests about the logic for determining the default work item query in the Pending Changes window in Visual Studio. Here is how it works.

 

In the Pending Changes window, the work item query uses an MRU list. In general, once a query is run in the work item channel, the last-run query for a team project becomes the default query for that team project in the work item channel.

 

Algorithm for determining the query for the work item channel in VS

  1. If the work item channel already has a query MRU list (ie. work item channel already opened before):
    1. If the team project for the last query is still in TE, the query is used. If the team project is no longer in TE, the next query in the MRU list, whose team project is still in TE, is used.
    2. If no other query is available from MRU, go to step 2.ii
  1. If the work item channel does not have a query MRU list (ie. the very first time opening the work item channel):
    1. The TE active project is used to search for query My Work Items. If found, that is the initial default query. If not found, go to next step.
    2. Starting with the first team project in TE, search each project for query My Work Items. The first My Work Items query found is the initial default query. If one is not found, go to next step.
    3. The first query of the first team project is the initial default query

 

Delete the following cache file to clear the MRU history:

C:\Documents and Settings\<YourUserName>\Local Settings\Application Data\Microsoft\Team Foundation\1.0\Cache\WorkItemHistory_<YourServerGUID>

C:\Documents and Settings\<YourUserName>\Local Settings\Application Data\Microsoft\Team Foundation\2.0\Cache\WorkItemHistory_<YourServerGUID>