HOW TO

Use ArcObjects to detect conflicts during a geodatabase reconcile operation

Last Published: April 25, 2020

Summary

Instructions provided describe how to programmatically detect conflicts found during a reconcile operation using ArcObjects.

Procedure

The following ArcObjects code snippet can be used to detect conflicts that arise during a reconcile operation:
Code (C#):

public void ReconcileandPost(IVersion editVersion, IVersion targetVersion)
{
    IMultiuserWorkspaceEdit muWorkspaceEdit = (IMultiuserWorkspaceEdit)editVersion;
    IWorkspaceEdit workspaceEdit = (IWorkspaceEdit2)editVersion;
    IVersionEdit4 versionEdit = (IVersionEdit4)workspaceEdit;

    if (muWorkspaceEdit.SupportsMultiuserEditSessionMode(esriMultiuserEditSessionMode.esriMESMVersioned))
    {
        muWorkspaceEdit.StartMultiuserEditing(esriMultiuserEditSessionMode.esriMESMVersioned);
        //Reconcile with the target version.
        bool conflicts = versionEdit.Reconcile4(targetVersion.VersionName, true, false, false, false);
        if (conflicts) MessageBox.Show(" Conflicts Detected ");
        else MessageBox.Show(" No Conflicts Detected ");
        workspaceEdit.StartEditOperation();
        //Post to the target version.
        if (versionEdit.CanPost()) versionEdit.Post(targetVersion.VersionName);
        workspaceEdit.StopEditOperation();
        workspaceEdit.StopEditing(true);
    }
}
Note that there is an interface called IVersionEdit4, and a method called Reconcile4. This method takes five parameters; the third parameter (a Boolean) allows you to detect conflicts. Once conflicts are detected, you can use the IVersionEdit4.ConflictClasses property to enumerate through each conflict, and handle it programmatically. See the link below to this property.

Article ID:000015646

Software:
  • ArcObjects SDK Microsoft NET Framework
  • ArcGIS Engine

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Related Information

Discover more on this topic