how to remove TFS workspace mapping for another user
Asked Answered
tfs
E

10

70

I am using Visual Studio 2010. Some months back I was using some 'ABC' TFS user to connect to TFS and mapped some folders on my local drive. Now my previous user 'ABC' is gone and I am allotted a new tfs user 'XYZ' to connect to TFS. So naturally I tried mapping some remote folder to my existing local folder and I got the following error.

"The working folder 'Some_Local_Path' is already in use by the workspace WORKSPACE_NAME:USER_NAME on computer 'MACHINE_NAME'"

I have tried removing the cache folder contents but the same error (C:\Users{UserName}\AppData\Local\Microsoft\Team Foundation\3.0\Cache). I have also tried running the commonly found TFS command (tf workspaces /remove:*) to delete the caches for all worksapaces but still the same error. When I try to edit my workspace, it shows source control and local folders for my current user 'XYZ' but what I want is to remove the folder bindings for my previous user 'ABC'. How can I achieve that?

Evermore answered 3/2, 2015 at 12:19 Comment(0)
E
62

You need to get your TFS administrator to delete the workspace if you have no access to the account.

You may be able to do it by calling "tf workspace" with the explicit user specified, but you need "manage other users workspace" permission. TF Sidekicks uses the same commands so would require the same permission. It is a TFS admin productivity tool.

https://msdn.microsoft.com/en-us/library/y901w7se(v=vs.100).aspx

You can use:

tf workspace /delete "WORKSPACENAME;PREVIOUSUSERACCOUNT"
Eudosia answered 3/2, 2015 at 18:44 Comment(3)
I can vouch, TF Sidekicks is definitely able to delete more than all of the posted command lines with simple "workspace";"owner". I notice the owner shows up as a guid string in the Sidekicks UI... maybe that's the secret - because, when i attempt to delete via command line i get "does not exist".Waler
In azure devops, permission required to delete is "Administer workspaces"Pestalozzi
Where/how do I get to a location where I can enter these commands?Middling
R
54

I had a similar issue and could not install sidekick because I'm running VS 2k17.

I was unable to delete the workspace because it kept telling me it could not find the workspace.

 tf workspaces /computer:* /owner:* 

This would list all of my workspaces and the owners. So I would try

 tf workspace /delete myWorkSpaceName;Bob Smith


 TF14061:  The workspace myWorkSpaceName;Bob Smith does not exist.

That is the exact workspace and owner name I was getting in the original workspace listing above.

The solution was to ask for xml format

tf workspaces /computer:* /owner:* /format:xml > c:\temp\workspaces.xml

(Note: Output to file is optional, but recommended)

This gives workspace owner aliases and one of them was a long name with a guid and the account email. This finally worked:

tf workspace /delete myWorkSpaceName;aabe3ec12-1254-4956-b1ee-3fb26506931e\[email protected]

It asked for a confirmation and finally deleted my orphaned workspace.

Reid answered 6/6, 2018 at 15:5 Comment(6)
This answer is better, as it does not rely on 3rd party software and gives more insight. Thx LarryGLenticel
Brilliant! This helped my team get unblocked!Folkways
Command you specify to delete didn't work for me but this worked instead: tf workspace /delete /collection:servername:8080/tfs/defaultcollection workspacename;domain\usernameProcure
you were getting - The workspace myWorkSpaceName;Bob Smith does not exist - because your name contains space and it has to be covered with quotes. Try this : tf workspace /delete "myWorkSpaceName;Bob Smith"Merylmes
I tried it with and without quotes and it did not work either way. It wasn't until i referenced the GUID that I was allowed to delete it.Reid
The /format:xml did the trick for me. I couldn't find a workspace for a user, even though it was listed. Seeing that there were different aliases for the user, I could use the one with the old domain and the command executed as desired. Thanks!Byssus
T
48

If you have administrative rights to the collection you can use the TF command located in the Visual Studio\Common7\IDE directory to do this without having to install another tool.

First list the workspaces associated with the user:

TF workspaces /collection:"http://tfsserver:8080/tfs/collection_name" /owner:owner_id

This will return the list of workspaces owned by the user and computer they are associated with

To delete a named workspace:

TF workspace /delete workspacename;owner_id /collection:"http://tfsserver:8080/tfs/collection_name"

Timbrel answered 19/2, 2016 at 15:1 Comment(3)
I can't just go around deleting other users workspaces because they left a file checked out. -- Unfortunately, it's a local, and private workspace, and somehow the file is still locked by them... -- there's gotta be a command to unlock it though...Dowser
When you delete a workspace, dont specify the /collection - it only works without it.Anderton
Worked for me. Thanks!Koenraad
M
17

First of all you need to install TFS Sidekick (you can download it from http://www.attrice.info/cm/tfs/) In installation phase choose Integrated with IDE mode

Then a new menu will be added to Visual Studio as below

Menus -> Tools -> TeamFoundation Sidekick

enter image description here

Then open workspace sidekick Search for the 'ABC' user and then you can delete his workspace

enter image description here

Mimicry answered 3/2, 2015 at 12:52 Comment(3)
Awesome utility which solved this issue when nothing else could. Thanks for the answer.Wantage
@Merylmes it works for who ever has permission, including AdminMimicry
Thank you! Awesome stand alone app, connects and works with Azure DevOps Server. I couldn't believe how many dead WorkSpaces were floating around due to getting new machines etc...Dicks
Q
4
  1. Open Source Control Explorer(View->Other Windows->Source Control Explorer)
  2. On toolbar pane there will be Workspace combo. Choose from that combo Workspacess..
  3. Edit
  4. Remove
Quondam answered 3/2, 2015 at 12:34 Comment(1)
For using this solution OP needs to login by 'ABC' user which is not accesibleMimicry
T
3

1.First we will check the list of workspaces from VS 2015 Developer command prompt,

Ex - tf workspaces /owner:*

2.Now we will get the xml format from VS 2017 Developer command prompt which will have ‘owner id’ for the particular workspace,

Example 1 - tf.exe workspaces /owner:* /computer:ComputerName /collection:https://YOUR-TFS-URL.visualstudio.com /format:xml

3.We can now delete the workspace for the particular user,

Example 1- Tf workspace /delete ComputerName;[email protected] /server:"https://URL.visualstudio.com"

OR

Example 2 - Tf workspace /delete ComputerName;1e178c77-bb8b-6f05-bf99 /server:https://URL.visualstudio.com

(Where 1e178c77-bb8b-6f05-bf99 is ID of the workspace which you get from Step 2 XML format)

4.Again we will check the list of workspaces from VS 2015 Developer command prompt,

Ex - tf workspaces /owner:*

Tattler answered 25/6, 2019 at 15:46 Comment(0)
S
1

Steps to delete workspaces from the TFS server:

  1. Open Visual Studio Developer Command Prompt.

  2. Goto Program Files (x86) folder, depending on the installed visual studio select "Microsoft Visual Studio 12.0" folder. Here this I have selected it because I am having Visual Studio 2013 installed on my machine. Add this path in the command prompt. Add like "cd C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE"

    Note: If you have an access of the TFS server from the network then you can try it from any machine where Visual Studio has been installed or from the same TFS machine server if it has Visual Studio there.

  3. Check a list of workspaces under specific collection. Type below command to get the workspaces under one collection.

    cd C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\tf workspaces /server:http://{TFSServername}:8080/tfs/{CollectionName} /owner:*

    • In the above command replace {TFSServername} this with your TFS servername or the Server IP.
    • In the above command replace {CollectionName} this with actual TFS Collection Name.
  4. How to remove workspaces under specific collection. Check below command for the same.

    • tf workspace /server:http://{TFSServername}:8080/tfs//{CollectionName} /delete “{workspacename};{owner}”
    • Replace {workspacename} this with "Workspacename” which is there in the list of workspaces.
    • Replace {CollectionName} this with TFS Collection Name.

      E.g. tf workspace /server:http://{TFSServername}:8080/tfs//{CollectionName} /delete {Enter Exact Workspacename};{Enter ExtactOwnerName}

Succubus answered 25/5, 2018 at 7:26 Comment(0)
A
1

I had the same issue that after deleting the workspace using tf delete command, I was getting the error that the workspace was already mapped! Then I found out tf delete workspace command leaves the job incomplete so you have to also delete it from the cache manually as was suggested here:

https://community.dynamics.com/365/financeandoperations/b/dynamicsaxinsightbyanas/posts/d365fo-the-path-is-already-mapped-in-workspace

Amadavat answered 22/4, 2020 at 16:53 Comment(1)
(1) OP already tried removing the cache folder contents. Anything else in the article that can help? (2) Directly copy (excerpt) relevant info from link referenced (since links often break over time). (3) Please clarify "...leaves the job incomplete barbecues...". Perhaps you meant "...can leave the job incomplete - in which case..." Thanks!Intramuscular
J
0

I end up in same issue after the person who setup Jenkins left our company. He had setup workspace and TFS checkout was using alternate authentication. As his credentials are removed from msdn, TFS checkout started choking.

Following LarryG's solution helped to remove the workspace. Only difference is, I just used the windows live ID of the person, who left the company.

tf workspace /delete myWorkSpaceName;windowsliveID

Jaine answered 29/11, 2018 at 22:13 Comment(0)
F
0

💡 Pay attention at the commands tf vc workspaces and tf vc workspace.

For listing use workspaces (plural):

tf workspaces /collection:https://your.tf.server.url/tfs/collection /computer:* /owner:*

For deleting, use workspace (singular):

tf workspace /collection:"https://your.tf.server.url/tfs/collection" /delete buildName;owner /noprompt
Flexuosity answered 14/2, 2024 at 18:47 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.