northpole

Getting Version specific modified feature classes names

Discussion created by northpole on Apr 8, 2013
Hello everyone,
I was wondering if there is anyway we can get the modified featureclass names in an ArcSDE Geodatabase for a specific version through ArcObjects. Here is the code snippet which I am using but it always returns '0' featureclass names though, I can check from the 'Version Changes' dialog that there are feature classes modified in this version.

         public List<string> getVersionModifiedFCs(IWorkspace workspace, string versionName)
        {
            List<string> modifiedFCs = new List<string>();
            try
            {
                IVersionEdit versionEdit = (IVersionEdit)workspace;

                IWorkspaceEdit2 workspaceEdit2 = (IWorkspaceEdit2)workspace;

                
                workspaceEdit2.StartEditing(false);
                workspaceEdit2.StartEditOperation();

                versionEdit.Reconcile(versionName);

                IEnumBSTR modifiedClassesEnum = versionEdit.ModifiedClasses;


                String fcName = null;

                while ((fcName = modifiedClassesEnum.Next())!=null)
                {
                    modifiedFCs.Add(fcName);

                    //fcName = modifiedClassesEnum.Next();
                }

                for (int i = 0; i < modifiedFCs.Count; i++)
                {
                    System.Diagnostics.Trace.WriteLine("modified feature class " + i.ToString() + ": " + modifiedFCs[i]);
                }

                modifiedClassesEnum = null;

                workspaceEdit2.StopEditOperation();
                workspaceEdit2.StopEditing(false);
            }
            catch (COMException comExc)
            {
                reportComException(comExc);
            }
            catch (Exception exc)
            {
                reportException(exc);
            }

            return modifiedFCs;
        }


My first reservation on this code snippet is that why we have to open an edit session to get modified featureclass names but I did it because the documentation asks for having a reconcile operation. Secondly, I also tried getting the featureclass names through below code but with no gain.

        IWorkspaceEdit2 workspaceEdit2 = (IWorkspaceEdit2)workspace;
        IDataChangesEx dataChangesEx = workspaceEdit2.get_EditDataChanges(scope);

        // Show the changes for each modified class in the workspace.
        IEnumBSTR modifiedClasses = dataChangesEx.ModifiedClasses;


Lastly, I know I can list all the featureclasses from the Geodatabase and then check the version changes for each featureclass but I think it would be a very ugly solution.

I am working with ArcGIS 10.1 on Windows 7 (64bit) with ArcSDE 9.3.1 (64bit) and this snippet works as an addon to ArcCatalog. So, kindly share your thought if there is anyway we can get list of modified featureclasses for a specific version through ArcObjects API. In advance I thank you for your time and help.

Outcomes