Keep in mind that you will need the appropriate rights. The permissions are called “Undo other users’ changes” and “Unlock other users’ changes”. These permissions can be viewed by

  1. Right-clicking the desired project, folder, or file in Source Control Explorer.
  2. Select Properties.
  3. Select the Security tab.
  4. Select the appropriate user or group in the Users and Groups section at the top.
  5. View the “Permissions for [user/group]:” section at the bottom.
Unlocking files and folders locked by some employee on TFS

Next way is:

If you login into the source control with the admin account, you will be able to force undo checkout, or check in with any file you provide.

Undo TFS code checked by another user:

You must have admin right and then by using below command you can undo code which is checked by other user who is not in company now. Use * if you want to undo all file with in given folder or in case of single file pass the name of specific file.

Syntax is:
tf undo {file path} /workspace:{workspace};{username}
 
Sample command are below
tf undo $/CmpProject/Project_2/MAIN/APP1.1/Encrypt.sln /workspace:WorkspaceName

tf undo $/CmpProject/Project_2/MAIN/APP1.1/* /workspace:WorkspaceName

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.

List all 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 given workspace:

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

Nutshell

If you are admin then login into the source control with your admin account, you will be able to force undo checkout, or check in with any file you provide.

Check More:

I hope you enjoyed reading this post. For more information you can check out Microsoft learn.

For more information you can visit our C# Section for more such posts.

Leave a Reply

Your email address will not be published. Required fields are marked *

Explore More

How To Fix Azure Functions Timer Trigger Unable to Start Running Locally with Vs2022 17 2 X Azurite

Lately my VS2022 (17.2.x) Azure Functions projects started failing to run locally. The local console had errors related to not being able to start any of the Timer Triggers. The

How to get the nuget cache folder location programmatically

While programming if I need to get from a .NET app (not .NET Core app) the list of directories where NuGet stores its packages. Let’s see how to do this.

How can I clear the NuGet package cache using the command line?

You can do this using Visual Studio menu on UI or by using command. You have two ways to do this. Let’s check: First Option: Let’s move with first option,