Search Wiki:
Using
Microsoft.TeamFoundation.WorkItemTracking.Client

Sample Code
// populate a TreeView with the work item queries for a particular team project
treeView.Nodes.Clear();
 
foreach (QueryItem queryItem in teamProject.QueryHierarchy)
{
    GetNodesForQueryFolder(queryItem as QueryFolder, treeQueryView.Nodes);
}
 
private void GetNodesForQueryFolder(QueryFolder queryFolder, TreeNodeCollection nodes)
{
    TreeNode folderNode = new TreeNode(queryFolder.Name);
    folderNode.Tag = queryFolder;
    nodes.Add(folderNode);
 
    foreach (QueryItem queryItem in queryFolder)
    {
        if (queryItem is QueryFolder)
        {
            GetNodesForQueryFolder(queryItem as QueryFolder, folderNode.Nodes);
        }
        else
        {
            TreeNode itemNode = new TreeNode(queryItem.Name);
            itemNode.Tag = queryItem;
            folderNode.Nodes.Add(itemNode);
        }
    }
}
Last edited Oct 8 2009 at 6:00 PM  by JimLamb, version 1
Comments
jaschwa wrote  May 30 2012 at 2:52 PM  
This example has been divorced from it's context. From what I can find on MSDN, 'teamProject' is the Project property of a WorkItem object. See http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.workitemtracking.client.workitem

Updating...
Page view tracker