ArcGIS Pro 3.1 API Reference Guide
ArcGIS.Core.Data Namespace / VersionManager Class / CreateHistoricalVersion Method
The HistoricalVersionDescription that specifies what the historical version should look like.
Example

In This Topic
    CreateHistoricalVersion Method
    In This Topic
    Creates a new HistoricalVersion. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax

    Parameters

    historicalVersionDescription
    The HistoricalVersionDescription that specifies what the historical version should look like.
    Exceptions
    ExceptionDescription
    historicalVersionDescription is null.
    The HistoricalVersionDescription.Name value in historicalVersionDescription is null or an empty string.
    The underlying data store is a Feature Service Database, which does not support creating HistoricalVersions.
    A geodatabase-related exception has occurred.
    This method or property must be called within the lambda passed to QueuedTask.Run
    Example
    Creating a Historical version
    public HistoricalVersion CreateHistoricalVersion(Geodatabase geodatabase, string versionName)
    {
      using (VersionManager versionManager = geodatabase.GetVersionManager())
      {
        HistoricalVersionDescription historicalVersionDescription = new HistoricalVersionDescription(versionName, DateTime.Now);
        HistoricalVersion historicalVersion = versionManager.CreateHistoricalVersion(historicalVersionDescription);
    
        return historicalVersion;
      }
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.0 or higher.
    See Also