I´m currently using the following code to find a branch inside a tfs-project by a specified label:
TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(new Uri(tfsuri));
var vcs = tfs.GetService<VersionControlServer>();
string labelscope = labelscopepath;
var specifiedBranch = vcs.QueryLabels(label, labelscope, null, true);
But this way I only get branches when I know the name of the label. So what I need now is a methode to find all labels inside the specified project and the related branches.
So here is my TFS-structure. The branch "Branch2" has the label "Label1". Now I´d like to list all branches that have a label, including the labelname. In this case only Branch2 would be in this list.