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 Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: