Unlocking files in TFS

If you ever come across a situation where someone has left the company or go for holiday with files locked, you can follow these steps to remove an existing lock.

The user had not unlocked all files before having over their old machine and was receiving the message “TFS10151: Cannot lock item”.

This is the message the user received when trying to edit a previously locked file.

TFS 2007
To unlock the file, run the following command:
C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE>tf undo /workspace:workstation_name;DOMAIN\user $/Project/path

To get a list of workspaces run this:
C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE>tf workspaces /owner:DOMAIN\user /computer:*

TFS 2010
To unlock the file, run the following command:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE>tf undo /workspace:workstation_name;username /server:http://website.com:8080/tfs/Collection_Name
$/Project/path

If the user has left the company, you may want to delete his workspace. Deleting the workspace also removes the lock on the files, but deleted workspace cannot be recovered.

To delete the workspace, run the following command:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE>tf workspace /delete /server:http://website.com:8080/tfs/Collection_Name workstation_name;domain\username


		
Advertisements

One thought on “Unlocking files in TFS

  1. You may consider the following instructions when such bad things happens you must unplug the SD cards to prevent the files for father loss.

    Battery life on the LG Venice is decent, with the same caveats of many other phones, like not leaving games
    or You – Tube running in the background. Today
    most commonly used cameras are high definition video recorder cameras
    that are commonly known as camcorders.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s