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

Creates a new workspace. The calling identity must have CreateWorkspace global permission. The computer attribute is the current machine. 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 Function CreateWorkspace ( _
    name As String, _
    owner As String, _
    comment As String, _
    mappings As WorkingFolder() _
) As Workspace
Dim instance As VersionControlServer 
Dim name As String 
Dim owner As String 
Dim comment As String 
Dim mappings As WorkingFolder()
Dim returnValue As Workspace 

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


  • 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 that you want to use 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.

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. The computer attribute uses the current computer. An exception occurs if the workspace cannot be created.

.NET Framework Security

See Also


VersionControlServer Class

VersionControlServer Members

CreateWorkspace Overload

Microsoft.TeamFoundation.VersionControl.Client Namespace