ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Core.Data Namespace / Version Class / Post Method
If PostOptions.TargetVersion is not specified in postOptions, then the target version is the Default version.
Example

In This Topic
    Post Method (Version)
    In This Topic
    Posts this version against a target version specified in postOptions. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public void Post( 
       PostOptions postOptions
    )
    Public Sub Post( _
       ByVal postOptions As PostOptions _
    ) 

    Parameters

    postOptions
    If PostOptions.TargetVersion is not specified in postOptions, then the target version is the Default version.
    Exceptions
    ExceptionDescription
    postOptions is null.
    This operation is not supported in client-server mode because the data store supports multi-branch versioning.

    A Selection object specified in PartialPostSelections is not from a feature service feature class.

    -or-

    Post cannot be performed in an active edit session.

    A geodatabase-related exception has occurred.
    This method or property must be called within the lambda passed to QueuedTask.Run
    Remarks
    If the underlying data store supports branch versioning and partial posting, this operation will post the data specified by PartialPostSelections to the Default version. In addition, after the partial posting operation is complete, the API will perform another Reconcile operation. This operation is not supported in traditional versioning.
    Example
    Reconciling and Posting a Version with its Parent in separate edit sessions
    public void ReconcileAndPost(Geodatabase geodatabase)
    {
        // Get a reference to our version and our parent
        if (geodatabase.IsVersioningSupported())
        {
            using (VersionManager versionManager = geodatabase.GetVersionManager())
            using (Version currentVersion = versionManager.GetCurrentVersion())
            using (Version parentVersion = currentVersion.GetParent())
            {
    
                //// Create a ReconcileDescription object
                //At 2.x - 
                //ReconcileDescription reconcileDescription = new ReconcileDescription(parentVersion);
                //reconcileDescription.ConflictResolutionMethod = ConflictResolutionMethod.Continue; // continue if conflicts are found
                //reconcileDescription.WithPost = true;
    
                //// Reconcile and post
                //ReconcileResult reconcileResult = currentVersion.Reconcile(reconcileDescription);
    
                // ReconcileResult.HasConflicts can be checked as-needed
    
                // Create a ReconcileOptions object
                ReconcileOptions reconcileOptions = new ReconcileOptions(parentVersion);
                reconcileOptions.ConflictResolutionMethod = ConflictResolutionMethod.Continue; // continue if conflicts are found
                reconcileOptions.ConflictDetectionType = ConflictDetectionType.ByRow; //Default
                reconcileOptions.ConflictResolutionType = ConflictResolutionType.FavorTargetVersion;//or FavorEditVersion
    
                // Reconcile
                ReconcileResult reconcileResult = currentVersion.Reconcile(reconcileOptions);
                if (!reconcileResult.HasConflicts)
                {
                    //No conflicts, perform the post
                    PostOptions postOptions = new PostOptions(parentVersion);
                    //var postOptions = new PostOptions(); for default version
                    postOptions.ServiceSynchronizationType = ServiceSynchronizationType.Synchronous;//Default
                    currentVersion.Post(postOptions);
                }
    
            }
        }
    }
    Reconciling and Posting a Version with its Parent in the same edit session
    public void ReconcileAndPost2(Geodatabase geodatabase)
    {
        // Get a reference to our version and our parent
        if (geodatabase.IsVersioningSupported())
        {
            using (VersionManager versionManager = geodatabase.GetVersionManager())
            using (Version currentVersion = versionManager.GetCurrentVersion())
            using (Version parentVersion = currentVersion.GetParent())
            {
    
                //// Create a ReconcileDescription object
                //At 2.x - 
                //ReconcileDescription reconcileDescription = new ReconcileDescription(parentVersion);
                //reconcileDescription.ConflictResolutionMethod = ConflictResolutionMethod.Continue; // continue if conflicts are found
                //reconcileDescription.WithPost = true;
    
                //// Reconcile and post
                //ReconcileResult reconcileResult = currentVersion.Reconcile(reconcileDescription);
    
                // ReconcileResult.HasConflicts can be checked as-needed
    
                // Create a ReconcileOptions object
                ReconcileOptions reconcileOptions = new ReconcileOptions(parentVersion);
                reconcileOptions.ConflictResolutionMethod = ConflictResolutionMethod.Continue; // continue if conflicts are found
                reconcileOptions.ConflictDetectionType = ConflictDetectionType.ByRow; //Default
                reconcileOptions.ConflictResolutionType = ConflictResolutionType.FavorTargetVersion;//or FavorEditVersion
    
                PostOptions postOptions = new PostOptions(parentVersion);
                //var postOptions = new PostOptions(); for default version
                postOptions.ServiceSynchronizationType = ServiceSynchronizationType.Synchronous;//Default
    
                // Reconcile
                ReconcileResult reconcileResult = currentVersion.Reconcile(reconcileOptions, postOptions);
                if (reconcileResult.HasConflicts)
                {
                    //TODO resolve conflicts
    
                }
    
            }
        }
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also