Listing all Labels attached to a file or folder

Team System has a great labelling facility. Unfortunately, however, there's no easy way to determine if a given file (foo.cs) or folder ($/myproject/) has labels attached to it.

When I posted a question about this on the official forums, we quickly determined that it wasn't possible out of the box. But Buck Hodges kindly pointed out a command-line code sample he posted last October which does exactly what we want!

Let's try it by passing in a file in our project, account.cs:

C:\Projects\WindowsFormsClient>LabelHistory account.cs
CI_20060706.1 (7/6/2006 3:34 PM)
CI_20060706.2 (7/6/2006 3:39 PM)
Label on just Account.cs (7/7/2006 10:49 AM)
   Comment: test

As expected, we see all the labels that were ever attached to account.cs. Now let's try it with no parameters:

C:\Projects\WindowsFormsClient>LabelHistory
CI_20060706.1 (7/6/2006 3:34 PM)
CI_20060706.2 (7/6/2006 3:39 PM)
Label on just Account.cs (7/7/2006 10:49 AM)
   Comment: test
Label on just program.cs (7/7/2006 10:49 AM)
   Comment: test
New Label (7/5/2006 1:35 AM)
   Comment: testing
This is a label on the folder WindowsFormsClient (7/7/2006 10:52 AM)

Notice that we picked up all the labels for the project folder and any files under the folder, including two labels I put on the single files account.cs and program.cs.

It's quite handy. I've packaged up Buck's solution for easier consumption:

posted on Friday, July 07, 2006 11:01 AM by jatwood

Comments

# VSTS Links - 07/10/2006

Eric Lee on be careful of proxy settings when using the Team Foundation Server Object Model, KPI and...
Monday, July 10, 2006 6:32 AM by Team System News

# re: Listing all Labels attached to a file or folder

This is really helpful. I happened to notice, though, that this does not order the labels by date.
I'm posting here because comments to Buck's posting are disabled.
Friday, September 22, 2006 8:06 AM by Dilip

# re: Listing all Labels attached to a file or folder

Could you please elaborate on how to add this to the add-in manager in VS 2005?
Thursday, October 05, 2006 12:06 PM by Sunny