tags:

views:

405

answers:

2

I'm trying to get a list of labels that apply to a particular version of a particular file in TFS Source Control. So far, I've gotten a set of labels that apply to any version of a particular file. Does anyone have any experience getting labels for a particular item?

For example, I have $/Project/Folder/Item.cs, which was modified in changesets 301, 401, and 601. Labels Build1 - Build 99 exist for the project. Build1 - Build10 were applied before changeset 301 (i.e. before Item.cs was created). Build96 - Build99 were applied to the v601 of Item.cs. If I run

vcServer.QueryLabels(null, "$/Project", null, false, "$/Project/Folder/Item.cs", new ChangesetVersionSpec(6))

I get Build11 - Build99 as results. I haven't figured out how to get a query to return fewer than this many labels. Ideally, the query I run will return 4 labels (Build96 - Build 99).

The context of this question is a TFS Project, with CCNET for a build server. I'm trying to relate work items to builds, starting with a work item number.

Any tips? Or examples of QueryLabels? Or better docs for QueryLabels than the MSDN docs?

A: 

It looks like it's not possible with the current TFS version, but may be with the next.

Matt Burke
+1  A: 

What you are wanting to do should definitely be possible using the API. The answer I gave to the other question was about seeing the labels inline with history in the UI.

For more information about doing what I think you are wanting to do, then take a look at:

and also

Hope that helps.

Martin.

Martin Woodward
I'm trying to do something fast, though. The approach in those links doesn't sound very fast. I want the api to do this:select top 1 *from tbl_Label l join tbl_LabelEntry le on l.LabelId = le.LabelIdwhere le.VersionFrom >= @ver and l.LabelName LIKE 'CIBuild%'order by l.LastModified asc
Matt Burke