pvdev
pvdev

Reputation: 230

Team Foundation Server - undo file lock for all users or workspaces

I need to create a scheduled task to remove a file lock or undo pending changes for a specific file (let's call this file $\MyProject\MyFile.cs). I know I can do this via the TFS command line utility using tf undo, which requires you to specify the user and the workspace.

However in this case the scheduled task does not know which user or workspace is locking the file, so I can't specify this in the command.

Is there a way of removing a lock on a file for all users and workspaces?

I had the idea of using tf status command to retrieve the user and workspace the file is locked to, then passing this into my tf undo command, but tf status seems to only show me the user and not the workspace name.

Apolgies in advance if there is already an answer to this question. I've been looking for hours and couldn't find a solution.

Upvotes: 0

Views: 136

Answers (1)

Cece Dong - MSFT
Cece Dong - MSFT

Reputation: 31013

Check case: tf.exe undo pending changes from other users, the answer in this case gave the solution to get all workspace:

tf status supports a /format parameter. The brief output (which is the default) doesn't include the workspace. the detailed one does.

tf status "$/MyProject" /s:MyServer /u:* /recursive /format:detailed

Upvotes: 1

Related Questions