IWorkspace2 Interface

Provides access to members that have information about the workspace.


The IWorkspace2 interface provides the NameExists method that facilitates determining the existance of the specified type of dataset with the supplied name. IWorkspace2 is only implemented for geodatabases and (at versions later than 9.3.1) shapefile workspaces.


Name Description
Read-only property NameExists Indicates if a dataset with the given name exists within the workspace.

IWorkspace2.NameExists Property

Indicates if a dataset with the given name exists within the workspace.

Public Function get_NameExists ( _
    ByVal Type As esriDatasetType, _
    ByVal Name As String _
) As Boolean
public bool get_NameExists (
    esriDatasetType Type,
    string Name


NameExistsallows you determine if a dataset of the specified type and the supplied name already exists within the Workspace. When the name string parameter is not qualified, NameExists will return True if any objects of the specified dataset type exists in the Workspace with the current user as the owner. When a fully qualified name parameter is specified, NameExistswill return True if an object of the specified dataset corresponds to the qualified name (on ArcSDE geodatabases a fully qualified name would be databasename.username.tablename). NameExistswill also consider tables that are not registered with the geodatabase.

The specified type must be supplied, the esriDTAny value is not supported.

If you would like to find out if a specific feature class exists in a feature dataset you should loop through the results of IFeatureClassContainer::ClassByName as NameExists will always check the entire Workspace for the existance of the feature class.

Classes that implement IWorkspace2

Classes Description
Workspace Workspace Object.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.