tags:

views:

285

answers:

1

Hello,

I would like to check out various files, edit them and check them back in. However, I do not wish to edit files that are already checked out so I would like to check for this before I make a call to Microsoft.TeamFoundation.VersionControl.Client.Workspace.PendEdit method. I could go through the following procedure:

Call GetPendingChanges
Store the pending changes in a list
Check if the file I am about to edit is in that list
Skip the checkout if it is in the list, proceed with checkout if it is no in the list.

However, I was hoping that there wass there a method I could call on the to do this. That is, one that returns a bool (or int, or enum) telling you if a file is checked out. I have looked, but can't find one.

Thanks in advance, Urvi

A: 

You can check the permissions of the file - readonly or not. Also store them in a dict, not list. Finally, there are GUI tools which integrate with TFS and do exactly what you are trying to program. There is also a command-line way.

Hamish Grubijan
I just realized that I did not define the problem correctly. The algorithm I outline was not correct. It would get *my* pending edits and checking permissions would work if I were just interested the files that I'd checked out. However, I would like to know if the file has been checked out by anyone *at all*. Sorry for the confusion, and thanks for any input. Urvi
Urvi
any sample for command-line way ?
alhambraeidos
Check out this link: http://patelshailesh.com/index.php/how-to-get-the-list-of-currently-checked-out-files-in-tfs
Hamish Grubijan