Dhandapani.C

IVersionEdit.CanPost always returning false

Discussion created by Dhandapani.C on Jul 21, 2011
Latest reply on Jul 28, 2011 by Dhandapani.C
Hi All,
I am trying to update the feature class inside the SDE workspace.  I am using VS2010, ArcObjects SDK 10.0.  The whole objective is to create a batch which runs every 24 hrs and update certain attributes.  I am using C#.Net and able to create Version without any flaw.

In the below code, every time the .CanPost method is returning false (I don't know why).  I've tried all the possible ways, and stuck....

             pVWSpace = (IVersionedWorkspace3)pWorkSpace; //Get the current versioned workspace
                pVersion = (IVersion2)pVWSpace.FindVersion(strVersionName);
                string sParentVersionName = null;
                pVWSpace = (IVersionedWorkspace3)DoStartEditing(pWorkSpace);
                pVSEdit = (IVersionEdit3)pVWSpace;
                if (pVersion.HasParent())
                {
                    sParentVersionName = pVersion.VersionInfo.Parent.VersionName;
                }
                else { return false; }
               
                if ((sParentVersionName != null))
                {
                    //Perform the Reconcile
                    if (pVSEdit.Reconcile2(sParentVersionName, false))
                    {
                        //If conflicts are detected, abort operation
                        //pVSEdit.AbortOperation();
                        return false;
                    }
                    else
                    {
                        pVSEdit.Reconcile2(sParentVersionName, true);
                        if (pVSEdit.CanPost())
                        {
                            pVSEdit.Post(sParentVersionName);
                        }
                    }
                }

--------

After the execution of code, I am able to post the version from ArcMap without any error, but through code I am not able to achieve this.... :(

Whats wrong in the above code...???

Thanks,
~Paul

Outcomes