ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Core.Data Namespace / HistoricalVersion Class
Members Example

In This Topic
    HistoricalVersion Class
    In This Topic
    Represents a historical version in a Geodatabase.
    Object Model
    HistoricalVersion ClassGeodatabase Class
    Syntax
    public sealed class HistoricalVersion : VersionBase, System.IDisposable  
    Public NotInheritable Class HistoricalVersion 
       Inherits VersionBase
       Implements System.IDisposable 
    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;
      }
    }
    Switching between versions
    public void ChangeVersions(Geodatabase geodatabase, string toVersionName)
    {
      using (VersionManager versionManager = geodatabase.GetVersionManager())
      {
        VersionBaseType versionBaseType = versionManager.GetCurrentVersionBaseType();
    
        if (versionBaseType == VersionBaseType.Version)
        {
          Version fromVersion = versionManager.GetCurrentVersion();
          Version toVersion = versionManager.GetVersion(toVersionName);
    
          // Switch between versions
          MapView.Active.Map.ChangeVersion(fromVersion, toVersion);
        }
    
        if (versionBaseType == VersionBaseType.HistoricalVersion)
        {
          HistoricalVersion fromHistoricalVersion = versionManager.GetCurrentHistoricalVersion();
          HistoricalVersion toHistoricalVersion = versionManager.GetHistoricalVersion(toVersionName);
    
          // Switch between historical versions
          MapView.Active.Map.ChangeVersion(fromHistoricalVersion, toHistoricalVersion);
        }
    
        // Switch from HistoricalVersion to Version and vice-versa 
        // MapView.Active.Map.ChangeVersion(fromHistoricalVersion, toVersion);
        // MapView.Active.Map.ChangeVersion(fromVersion, toHistoricalVersion);
    
      }
    }
    Inheritance Hierarchy

    System.Object
       ArcGIS.Core.CoreObjectsBase
          ArcGIS.Core.Data.VersionBase
             ArcGIS.Core.Data.HistoricalVersion

    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also