rankeny

Automating the Change Version functionality in ArcMap

Discussion created by rankeny on Dec 23, 2013
Latest reply on Jan 15, 2014 by sanjayjadhav
I'm trying to automatically change the version the user is connected to in ArcMap when a button is pushed but I'm having trouble finding the correct code interface. This is the first time I have had trouble finding the correct code and I am wondering if it is just not possible.

                _thisMap = _mHookHelper.FocusMap;
                IEnumLayer selLayers = _thisMap.get_Layers(pUID, true);
                ILayer aLayer = selLayers.Next();
                if (aLayer == null)
                {
                    throw new Exception("No Layers Present");
                }
                IFeatureLayer a_FLayer = (IFeatureLayer) aLayer;
                IFeatureClass a_FClass = a_FLayer.FeatureClass;
                ITable aTable = (ITable) a_FClass;
                IDataset aDS = (IDataset) aTable;
                _aWS = aDS.Workspace;
                IPropertySet pSet = _aWS.ConnectionProperties;
                object pProp = pSet.GetProperty("Version");
                string verName = pProp.ToString();
                if (!verName.Contains(editVersion))
                {
                 
                  CHANGE VERSION IN TOC HERE AUTOMATICALLY
     
                }

Outcomes