Home > C#, TFS > TFS SDK: List the areas

TFS SDK: List the areas

Go to the TFS Content Page


You access the areas via the Project’s AreaRootNodes properties.
The areas are hierachical, you have a collection of nodes that have children.

A example that return a flat list of all areas hierarchy:

public IList<string> GetAreaPaths(Project project)
{
   List<string> areas = new List<string>();
   foreach (Node node in project.AreaRootNodes)
      AddChildren(string.Empty, node, this.areas);
   return areas;
}

private void AddChildren(string prefix, Node node, List<string> items)
{
   items.Add(node.Path);
   foreach (Node item in node.ChildNodes)
      AddChildren(prefix + node.Name + "/", item, items);
}
Categories: C#, TFS
  1. No comments yet.
  1. No trackbacks yet.

Leave a comment