TFS workfold /unmap "Multiple workspaces exist with the name XYZ"

tf-cli, tfs

Solution

This has been reported as a bug here: https://connect.microsoft.com/VisualStudio/feedback/details/574162/tf-workfold-unmap-not-accepting-collection-option

See here for a workaround: http://wiert.me/2012/08/29/vs2010-workfold-command-allows-moving-a-local-working-folder-for-a-workspace-but-not-unmapping-it-when-you-have-multiple-workspaces-with-the-same-name/

Problem

I am trying to understand how to solve the following situation. I have a TFS 2012 server with three collections, say; ``` - http://tfs2012:8080/tfs/DefaultCollection/ - http://tfs2012:8080/tfs/CollectionOne/ - http://tfs2012:8080/tfs/CollectionTwo/ ``` In CollectionOne and CollectionTwo I have a workspace of the same name, lets call it "TestWorkspace". When I run a map command for that workspace on CollectionOne it works perfectly (can get, delete, update, etc). The issue comes when I try to unmap the workspace as I am done using it (think build machine), the following call fails. ``` tf.exe workfold /unmap /workspace:TestWorkspace E:\Temp ``` It fails with; ``` Multiple workspaces exist with the name TestWorkspace. Please specify the Team Foundation Server or qualify the name with the owner. ``` Therefore I try the following; ``` tf.exe workfold /unmap /workspace:TestWorkspace E:\Temp /collection:http://tfs2012:8080/tfs/CollectionOne/ ``` Which fails with the following; ``` The option collection is not allowed. ``` Also specifying the owner of the workpsace doesn't help as they are owned by the same user. How do I unmap a workspace which exists in two or more collections?

Original source