When I picked up on my old project on Codeplex (which runs Team Foundation Server), I found that there were items checked out by another user. Actually, it was me, but on a workspace on a different computer.
Shame on me for not checking those files in :$. It turned out that the GUI of Source Code Explorer does not support the Undo pending changes operation for work in another workspace. The command-line tool tf.exe does, however. Here’s how:
Open up a Visual Studio 2005 Command Prompt. First, run a command to see which workspaces are registered for a particular TFS server and owner. Run the following command:
tf workspaces /owner:ownername /server:URLtoTFS.
You should get a prompt that you are not authorized. After a second delay a login dialog for the Team Foundation Server pops up. Authenticate as a user with enough rights (at least Read permission set to Allow). The output shows the registered workspaces.
Next up, undo the pending changes for one (or all) of the workspaces. Determine the item(s) that need to be undone.
tf undo /workspace:workspacename /server:URLtoTFS “$/…/codefile.cs“
Here, the name of the workspace is the one that you got when you ran the workspaces command. Normally you will use the “other user’s” name and there should be only one. “$/…/codefile.cs” should be replaced with the complete path to the file, e.g. $/projectname/folder1/folder2/codefile.cs.
If you want to undo all files, it may be convenient to pick the root folder and do a recursive undo:
tf undo /workspace:workspacename /server:URLtoTFS /recursive “$/projectname“
That should get you going. Now remember to check those files in next time!