VersionControlServer.CreateWorkspace Method (String, String, String, array<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)

Syntax

'Declaration
Public Function CreateWorkspace ( _
    name As String, _
    owner As String, _
    comment As String, _
    mappings As WorkingFolder(), _
    computer As String _
) As Workspace
'Usage
Dim instance As VersionControlServer 
Dim name As String 
Dim owner As String 
Dim comment As String 
Dim mappings As WorkingFolder()
Dim computer As String 
Dim returnValue As Workspace 

returnValue = instance.CreateWorkspace(name, _
    owner, comment, mappings, computer)
public Workspace CreateWorkspace(
    string name,
    string owner,
    string comment,
    WorkingFolder[] mappings,
    string computer
)
public:
Workspace^ CreateWorkspace(
    String^ name, 
    String^ owner, 
    String^ comment, 
    array<WorkingFolder^>^ mappings, 
    String^ computer
)
public function CreateWorkspace(
    name : String, 
    owner : String, 
    comment : String, 
    mappings : WorkingFolder[], 
    computer : String
) : Workspace

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: array<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.

Remarks

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.

.NET Framework Security

See Also

Reference

VersionControlServer Class

VersionControlServer Members

CreateWorkspace Overload

Microsoft.TeamFoundation.VersionControl.Client Namespace