Export (0) Print
Expand All
Expand Minimize

VersionControlServer.TryGetWorkspace Method

This method starts with a local path and finds a workspace that contains a mapping to that path. Workspace mappings are recursive: if you pass C:\code\CmdLine and no explicit mapping for C:\code\CmdLine is found, Team Foundation Server will search for a mapping to C:\code and then C:\. The search is restricted to mappings for the current user on the current computer.

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

public Workspace TryGetWorkspace(
	string localPath
)

Parameters

localPath
Type: System.String

The local path for which you want to create a workspace.

Return Value

Type: Microsoft.TeamFoundation.VersionControl.Client.Workspace
Returns a reference to the Workspace object that has mapped the specified local path. If no workspace is found, this method returns null. If you want to throw an exception instead, you can use the GetWorkspace method.

This is similar to GetWorkspace. However, if the path is not in any known local workspace, TryGetWorkspace returns null instead of throwing an exception.

Community Additions

ADD
Show:
© 2014 Microsoft