다음을 통해 공유


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(null, null, null, false, i.ServerItem, null));
}

Comments

  • Anonymous
    April 29, 2009
    PingBack from http://asp-net-hosting.simplynetdev.com/how-to-query-all-labels-on-a-folder-recursively/

  • Anonymous
    May 06, 2009
    Mohamed Mahmoud on How to: Query all labels on a folder recursively Brian Harry on Power Tool for Profiling

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

  • Anonymous
    March 27, 2012
    i want fetch latest label from tfs plz help me........