0

I am using the 2012 edition of the TFS Client Object Model to retrieve some file information within repositories. Given a string specifying the path to a file in a TFS project, I'd like to find out who has checked out a file if it is locked. I use VersionControlServer.GetItems(...).Items and a Where predicate to get only the files (not folders) I am interested in.

Zoe
  • 27,060
  • 21
  • 118
  • 148
gdoug
  • 715
  • 1
  • 5
  • 16
  • I find that it's easier to just have a look in Visual Studio and TFS to see who has a file checked out or locked. Have you tried looking at: http://msdn.microsoft.com/en-us/library/bb138911.aspx (all the other GetItems(...) found here: http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.versioncontrol.client.versioncontrolserver.getitems.aspx) – xcodr Feb 12 '14 at 05:17
  • I need to do it programmatically. Its for a project, not just for my own code management. :) – gdoug Feb 12 '14 at 06:26

1 Answers1

1

QueryPendingSets is your friend!

Sample:

PendingSet[] queryPendingSets = versionControlServer.QueryPendingSets(new [] {"$/A/B/C.txt"},RecursionType.None, null, null );

This lists all pending changes for the specified file. You can get them all by looking at:

queryPendingSets[0].PendingChanges
Scordo
  • 1,041
  • 7
  • 12