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


IWorkspace2.NameExists Property (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference (GeoDatabase)  

IWorkspace2.NameExists Property

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

[Visual Basic .NET]
Public Function get_NameExists ( _
    ByVal Type As esriDatasetType, _
    ByVal Name As String _
) As Boolean
[C#]
public bool get_NameExists (
    esriDatasetType Type,
    string Name
);
[C++]
HRESULT get_NameExists(
  esriDatasetType Type,
  BSTR Name,
  VARIANT_BOOL* Exists
);
[C++]

Parameters Type [in]
Type is a parameter of type esriDatasetType Name [in] Name is a parameter of type BSTR Exists [out, retval] Exists is a parameter of type VARIANT_BOOL

Product Availability

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

Remarks

NameExists allows 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, NameExists will 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). NameExists will 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.

See Also

IWorkspace2 Interface

.NET Snippets

Create Table | Create FeatureClass

.NET Related Topics

Creating tables