I recently ran into a situation where I had “inherited” a laptop from a previous developer on a project. This laptop was on the customer’s domain, and had been configured for source control using Team Foundation Services.
A problem arose after logging in using my own credentials, and attempting to map the TFS root (“$/”) to the standard local source root (“C:\TFS”). I was unable to proceed due to the following message:
“The working folder is already in use by the workspace XXXXXXX;email@example.com”
(^^^ where details have been hidden to protect the innocent)
Visual Studio did not provide any mechanism for deleting this existing workspace mapping, however I found a solution by dropping to the command line:
tf workspace /delete /server:OURTFSSERVER\DefaultCollection XXXXXXX;firstname.lastname@example.org
After a confirmation warning that the deleted workspace cannot be recovered, I was able to map my own workspace to the standardised root.
Inevitably somebody on the team goes away on holidays and forgets to check everything into TFS (guilty, as charged!)
There’s no facility to unlock somebody else’s files through TFS Explorer, so we have to resort to the command line. Firstly, get the list of the user’s workspaces:
tf workspaces /server:tfsserver /owner:DOMAIN\offender /computer:*
This will list the workspaces “owned” by the offending little tyke absent user, which we will feed into the next command:
tf undo /server:tfsserver /workspace:workspacename;DOMAIN\offender $/path/to/file/to/unlock
Now you’re free to change the file at will, and reprimand your teammate when he gets back from his holiday, all tanned and relaxed.
Another FYI: just type in tf on the command line, and it will open up the appropriate help file. Sweet!