Weve been struggling with this for a while now. We have a Mxd with over 400 layers. We switched from an sde connection to a Direct Connect. Now when we need to publish the map to a clients server there connection settings might be different. We are required then to open the mxd and change every layers connection individually.
I wrote an application to change the instance but we have a few problems.
pFeatureLayer = pEnumLayer.Next() as IFeatureLayer; } }
} pMapDocument.ReplaceContents(pMap as IMxdContents); pMapDocument.Save(true, false); pMapDocument.Close();
The above code opens the Map Document and change every SDE Feature layers Datasource Instance Property to direct connection from SDE (5151).
In the process all Joins are lost and the registered Geo Database and version on the layer. So the main reason behind the application is to take out the manual process of changing the Layer Dataset properties.
Is there a way to get and change all joins and keep the versioning. Is there a way that we dont need to make these changes and only need to change a property in ArcMap so that the rule applies for all feature layers?
At the end of the day when the Map Document opens up eventually we need to add all the joins back because the Join still pointed to an SDE instance.