Welcome to MSDN Blogs Sign in | Join | Help

How to: Query all labels on a folder recursively?

To do this, you can't call query labels with a wildcard character, you need to do the following:
 
- Get all items blow $/Dir1 using GetItems
- Loop through them calling QueryLabels on each one.
 
Here's a code snippet:

VersionControlServer sc = tfs.GetService<VersionControlServer>();
List<VersionControlLabel> labels = new List<VersionControlLabel>(); 

foreach (Item i in sc.GetItems("$/Proj"RecursionType.Full).Items)
{
   labels.AddRange(sc.QueryLabels(nullnullnullfalse, i.ServerItem, null));
}

Published Thursday, April 30, 2009 12:49 AM by mohamedg
Filed under: , ,

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# How to: Query all labels on a folder recursively? | ASP NET Hosting

# VSTS Links - 05/06/2009

Mohamed Mahmoud on How to: Query all labels on a folder recursively Brian Harry on Power Tool for Profiling

Wednesday, May 06, 2009 11:57 AM by Team System News

# re: How to: Query all labels on a folder recursively?

I think I will try to recommend this post to my friends and family, cuz it’s really helpful.

Tuesday, September 22, 2009 12:11 PM by Max Shoes

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker