ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Core.Data.DDL Namespace / SchemaBuilder Class / Rename Method
Indicates the object to be renamed.
The new name of the object.
Example

In This Topic
    Rename Method (SchemaBuilder)
    In This Topic
    Enqueue the rename operation on the object with the name referred to by the Description. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Public Function Rename( _
       ByVal description As Description, _
       ByVal newName As String _
    ) As Token

    Parameters

    description
    Indicates the object to be renamed.
    newName
    The new name of the object.

    Return Value

    The Token for the object to be renamed.
    Exceptions
    ExceptionDescription

    Rename does not support description.

    -or-

    The new name is invalid.

    -or-

    The total path length for the renamed description must be less than 252 characters.

    The new name is invalid.
    description is null.
    Example
    Renaming a FeatureDataset
    public void RenameFeatureDatasetSnippet(Geodatabase geodatabase)
    {
        // Renaming a FeatureDataset from 'Parcel_Information' to 'Parcel_Information_With_Tax_Jurisdiction'
    
        string originalDatasetName = "Parcel_Information";
        string datasetRenameAs = "Parcel_Information_With_Tax_Jurisdiction";
    
        FeatureDatasetDefinition originalDatasetDefinition =
          geodatabase.GetDefinition<FeatureDatasetDefinition>(originalDatasetName);
        FeatureDatasetDescription originalFeatureDatasetDescription = new FeatureDatasetDescription(originalDatasetDefinition);
    
        SchemaBuilder schemaBuilder = new SchemaBuilder(geodatabase);
    
        // Rename the existing FeatureDataset, 'Parcel_Information' to 'Parcel_Information_With_Tax_Jurisdiction'
        schemaBuilder.Rename(originalFeatureDatasetDescription, datasetRenameAs);
        schemaBuilder.Build();
    }
    Renaming a Table
    public void RenameTableSnippet(Geodatabase geodatabase)
    {
        //Renaming a table from 'Original_Table' to 'Renamed_Table'
    
        string tableToBeRenamed = "Original_Table";
        string tableRenameAs = "Renamed_Table";
    
        TableDefinition tableDefinition = geodatabase.GetDefinition<TableDefinition>(tableToBeRenamed);
    
        SchemaBuilder schemaBuilder = new SchemaBuilder(geodatabase);
    
        // Table rename 
        schemaBuilder.Rename(new TableDescription(tableDefinition), tableRenameAs);
        schemaBuilder.Build();
    }
    Rename domain
    public void RenameDomain(Geodatabase geodatabase, string rangeDomainOldName = "PipeDiameter", string rangeDomainNewName = "PipeDiam")
    {
        SchemaBuilder schemaBuilder = new SchemaBuilder(geodatabase);
        RangeDomain rangeDomain = geodatabase.GetDomains().First(f => f.GetName().Equals(rangeDomainOldName)) as RangeDomain;
    
        // Renaming a domain
        schemaBuilder.Rename(new RangeDomainDescription(rangeDomain), rangeDomainNewName);
        schemaBuilder.Build();
    }
    Rename annotation feature class
    public void Rename(SchemaBuilder schemaBuilder, AnnotationFeatureClassDefinition annotationFeatureClassDefinition, string featureClassNewName)
    {
        AnnotationFeatureClassDescription annotationFeatureClassDescription = new AnnotationFeatureClassDescription(annotationFeatureClassDefinition);
    
        // Enqueue rename operation
        schemaBuilder.Rename(annotationFeatureClassDescription, featureClassNewName);
    
        // Execute DDL
        schemaBuilder.Build();
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also