How to: Query All Labels on a Folder Recursively?

How to: Query All Labels on a Folder Recursively?

  • Comments 4
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));
}

Leave a Comment
  • Please add 2 and 2 and type the answer here:
  • Post
Page 1 of 1 (4 items)