Workspace Command

Lets you create, delete, view, or modify properties and mappings associated with a workspace.

tf workspace /new [/noprompt] [/template:workspacename[;workspaceowner]]
 [/computer:computername] [/comment:(“comment”|@comment file)]
 [/s:servername] [workspacename[;workspaceowner]]

tf workspace /delete [/server:servername] workspacename[;workspaceowner]

tf workspace [/server:servername] [/comment:comment] [/newname:workspacename]
 [workspacename[;workspaceowner]]

Parameters

Argument Description

workspacename

Specifies a name for the workspace to create, edit, delete, or display information about.

workspaceowner

Specifies a username for the workspace. This parameter is only required when the workspace owner is not the person performing the command.

computername

Provides a value to the /computer option.

comment

Provides a value to the /comment option.

@commentfile

Specifies the path of a file where the comment should be read.

servername

The user-provided value for the /server option. Example: teamfoundation2.

Option Description

/new

Creates a new workspace.

/template

Specifies an existing workspace to use as a template to create the new workspace. Mappings of the existing workspace will be used in the new workspace.

/delete

Deletes the specified workspace.

/computer

Specifies the name of the computer on which to create the workspace. This option is an advanced option.

/comment

Provides a comment describing the workspace.

/server

Identifies the Team Foundation Server. This option is required when you create a new workspace and when you try to start the workspace command from a directory that is not mapped to a workspace.

/newname

Renames an existing workspace.

/noprompt

Performs the specified workspace command without displaying a dialog box.

Remarks

A workspace is a local copy of the files and folders on the server plus any changes that you have made locally. When you add, edit, delete, move, rename, or otherwise change any source-controlled item, your changes are isolated in your workspace where you can make and test your changes. Your pending changes are committed to the server and become available to other users outside your workspace when you perform a check-in.

Creating a new workspace

Before you can add files to the source control server or check out items on the server in order to edit them, you must create a workspace or associate an existing one with the current directory. For more information, see How to: Create a Workspace.

To make the current directory a working folder for an existing workspace on your computer, type tf workspace ** workspacename, where workspacename is the name of the existing workspace, click click here to enter a new working folder, type the server path of which you want to map the current directory in the Team Foundation source control server Folder box, type the current directory in the Local Folder box, and then click OK.

When you create a new workspace, you can specify a template workspace as part of the /new option. When you specify a template workspace, Team Foundation creates a new workspace on the current computer, sets the owner to the current owner, and replicates the following workspace properties into the new workspace from the template workspace: mappings and comment. If no name is specified, a name based on the current computer name is used. When you create a workspace using a template, Team Foundation does not retrieve the files to which it maps from the server. Use the Get Command to synchronize the new workspace with the latest version on the server.

Deleting a Workspace

If you delete a workspace that contains pending changes, Team Foundation cancels the pending changes as part of the delete process. Deleting a workspace does not delete the files and folders on the client computer that were in that workspace.

Editing a Workspace

You can change the following workspace attributes:

  • Workspace Name

  • Comment

  • Working folder mappings

If no workspace specification is provided, the workspace for the current folder is used.

Examples

The following example opens the Create Workspace dialog box and creates a new workspace.

c:\projects>tf workspace /new /server:teamserver2

The following example creates a new workspace called Beta1 and assigns jenh as the workspace owner. You must have the AdminWorkspaces permission to assign ownership of a new workspace to another user. For more information on security permissions, see Team Foundation Server Permissions.

c:\projects>tf workspace /new Beta1;jenh

The following example creates a new workspace by using the Beta1 workspace that is owned by jenh as a template.

c:\projects>tf workspace /new /template:Beta1;jenh /server:teamserver2

The following example removes the Beta1 workspace from the system.

c:\projects>tf workspace /delete Beta1

The following example edits properties for the current workspace.

c:\projects>tf workspace

The following example opens the Beta1 workspace for which user jenh is the owner so that you can see its properties and mappings. If you have the AdminWorkspaces permissions, you can change the workspace properties and mappings.

c:\projects> tf workspace Beta1;jenh

Security

To modify or delete an existing workspace, you must be the owner or have the global Administer workspaces permission set to Allow. To create a workspace, you must have the global Create a workspace permission set to Allow. To create workspaces for other users, you must have the Administer workspaces permission set to Allow. For more information, see Team Foundation Server Permissions.

See Also

Tasks

Walkthrough: Working with Team Foundation Source Control from Command Line
How to: Create a Workspace
How to: Cloak and Decloak Folders in a Workspace

Reference

Command-Line Syntax
Workspaces Command

Concepts

Working with Source Control Workspaces

Other Resources

Tf Command-Line Utility Commands