Undo checkout or lock by another user

Scenario: Another user has locked a file for checkout, but is no longer available to check the file back in and now you need that file.

 

Unlocking the file

 

First you will need to get a list of the workspaces for that user. This can be done with administrative rights from the command line as follows:

 

tf workspaces /owner:DOMAIN\TheirUserAccount /computer:*

 

The command will retrieve a list of all workspaces on all computers for that user.

 

You can now use the output information to undo the checkouts on the files you want:

 

tf undo /workspace:TheirWorkspace;DOMAIN\TheirUserAccount $/path/to/file

 

In the event the developer is no longer with the company or on the project, you can also delete the workspace which will also undo any pending changes using the following command:

 

tf workspace /delete TheirWorkspace;DOMAIN\TheirUserAccount /s:https://TFSSERVER:8080