Retrieve all folders from TFS using the TFS SDK

I am creating a TFS tool that will receive change information from a TFS server.

Now I want to provide a "TFS Browser" so that the user can view which "branch / folder" he wants to get from.

I use the TreeView control and the GetItems function to get the path to the elements from TFS:

private void treeView1_BeforeExpand(object sender, TreeViewCancelEventArgs e)
{
    e.Node.Nodes.RemoveAt(0);
    RecursionType recursion = RecursionType.OneLevel;
    Item[] items = null;

    // Get the latest version of the information for the items.
    ItemSet itemSet = sourceControl.GetItems(e.Node.Tag.ToString(), recursion);
    items = itemSet.Items;

    foreach (Item item in items)
    {
        if (item.ServerItem == e.Node.Tag.ToString()) //Skip self
            continue;

        string filename = Path.GetFileName(item.ServerItem);

        if (Path.GetExtension(filename) == "")
        {
            TreeNode node = new TreeNode(filename, new TreeNode[] { new TreeNode() });
            node.Tag = item.ServerItem;
            e.Node.Nodes.Add(node);
        }
    }
}

The code below shows that after clicking the "expand" button from a node, the application will "request" elements below the current "branch" (e).

. , , "" , , , . , , "v1.1".

. GetItems . MSDN:

path , , . , , . , .

GetItems , , "" node .

, "" TFS? , , ?

!

+5
2

, , .ItemType Item. .

+2

, , GetFileTypes , . "" :

if (!Extensions.Contains(Path.GetExtension(item.ServerItem).Replace(".","").ToLower()))
{
    //Add Node
}

, . , FOLDER.DLL?

0

All Articles