This documentation is archived and is not being maintained.

VersionControlServer.CreateWorkspace Method (String, String, String, WorkingFolder[], String)

Creates a new workspace. The calling identity must have CreateWorkspace global permission. If you attempt to cloak a folder which is not actually mapped anywhere, an exception will occur: you can avoid this exception by using the overload method with fixMappingErrors.

Namespace:  Microsoft.TeamFoundation.VersionControl.Client
Assembly:  Microsoft.TeamFoundation.VersionControl.Client (in Microsoft.TeamFoundation.VersionControl.Client.dll)

public Workspace CreateWorkspace(
	string name,
	string owner,
	string comment,
	WorkingFolder[] mappings,
	string computer
)

Parameters

name
Type: System.String

The name of this workspace. The name must be unique for the current user, and must adhere to the following rules:

The string must not be null or empty.

The string must not end in white space.

The string length must be less than or equal to the constant RepositoryConstants.MaxWorkspaceNameSize (64 characters).

The name must not contain any characters that could not be part of a filename.

owner
Type: System.String

The owner of this workspace. You must use the string constant RepositoryConstants.AuthenticatedUser or "." to default to the current user.

comment
Type: System.String

A descriptive comment for the workspace.

mappings
Type: Microsoft.TeamFoundation.VersionControl.Client.WorkingFolder[]

An array of working folders that you want to establish for the workspace.

Each item in this array represents a server path ($/CmdLine) that you are either mapping to a local path (C:\code\CmdLine) or cloaking (in which case you do not specify any local path). Working folders are inherently recursive: if $/CmdLine maps to C:\code\CmdLine then $/CmdLine/shell will automatically map to C:\code\CmdLine\shell, so there is no need to specify that mapping explicitly.

computer
Type: System.String

The computer on which the workspace will exist.

Return Value

Type: Microsoft.TeamFoundation.VersionControl.Client.Workspace
Returns a reference to a Workspace object that represents the new workspace. If the workspace cannot be created, an exception occurs.

The calling identity must have the GlobalPermissionCreateWorkspace global permission. This method returns a reference to a Workspace object. An exception occurs if the workspace cannot be created.

Show: