This document is archived and information here might be outdated.  Recommended version.


IWorkspaceName Interface (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Geodatabase > ESRI.ArcGIS.GeoDatabase > Interfaces > IW > IWorkspaceName Interface
ArcGIS Developer Help

IWorkspaceName Interface

Provides access to members that supply workspace name information. Note: the IWorkspaceName interface has been superseded by IWorkspaceName2. Please consider using the more recent version.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

When To Use

Use IWorkspaceName when you are browsing for workspaces and do not want the overhead of instantiating Workspace objects.

Members

Name Description
Read/write property BrowseName The browse name of the WorkspaceName.
Read-only property Category The category of the WorkspaceName.
Read/write property ConnectionProperties The connection properties of the WorkspaceName.
Read/write property PathName The path name of the WorkspaceName.
Read-only property Type The type of the associated workspace.
Read-only property WorkspaceFactory The workspace factory of the WorkspaceName.
Read/write property WorkspaceFactoryProgID The ProgID of the WorkspaceName's workspace factory.

Classes that implement IWorkspaceName

Classes Description
WorkspaceName Esri Workspace Name object.

Remarks

The IWorkspaceName interface lets you access the properties of a workspace name. To work with a workspace name, you must first set the WorkspaceFactoryProgID property and either the PathName or ConnectionProperties property.

The workspace name can refer to an existing workspace, or one that has yet to be created. If the workspace already exists, it can be opened with IName::Open--effectively this procedure is equivalent to opening a workspace using Open or OpenFromFile on IWorkspaceFactory. If the workspace does not exist and is to be created, use IWorkspaceFactory::Create.

In some circumstances, you may already have a full workspace object but require a workspace name instead. You can retrieve the workspace name from a workspace by calling calling IDataset::FullName on the workspace.

The Type, Category, WorkspaceFactoryProgID, and BrowseName properties all return information on the workspace; refer to the documentation on IWorkspace.

[C#]

    //e.g., workspacePath = "D:\data\geodatabases\Usa.mdb"
    public void IWorkspace__get_WorkspaceName(string workspacePath, IWorkspace workspace)
    {
        //Creates a new workspace name for a personal geodatabase.
        IWorkspaceName workspaceName = new WorkspaceNameClass();
        workspaceName.WorkspaceFactoryProgID = "esriDataSourcesGDB.AccessWorkspaceFactory";
        workspaceName.PathName = workspacePath;
        //Or Get a workspace name from an existing workspace.
        IDataset dataset = (IDataset)workspace; //Workspaces implement IDataset
        workspaceName = (IWorkspaceName)dataset.FullName;
    }

[C++]
//  Create a new workspace name for a personal geodatabase and open it
IWorkspaceNamePtr ipWorkspaceName (CLSID_WorkspaceName);
ipWorkspaceName->put_WorkspaceFactoryProgID(CComBSTR(_T("esriDataSourcesGDB.AccessWorkspaceFactory")));
ipWorkspaceName->put_PathName(CComBSTR(_T("D:\\data\\geodatabases\\Usa.mdb")));
IUnknownPtr ipUnk;
((INamePtr)ipWorkspaceName)->Open(&ipUnk); // QI, WorkspaceName implements both IWorkspaceName and IName
IWorkspacePtr ipWorkspace (ipUnk); // You may now use ipWorkspace
// You already have a full workspace object but require a workspace name instead. IDatasetPtr ipDataset (ipWorkspace); // QI, CLSID_Workspace supports both IWorkspace and IDataset INamePtr ipName; ipDataset->get_FullName(&ipName); IWorkspaceNamePtr ipWorkspaceName (ipName); // You may now use ipWorkspaceName

See Also

IName Interface | IWorkspaceName Interface

.NET Samples

Create a Mosaic dataset Create a custom raster type from the ground up for DMCII data View CAD data in a MapControl