Updating and fixing data sources with arcpy mapping dating delft porcelain
Note: this dialog is intended primarily for preparing map documents for publication.
Customizations (VBA code, UI Controls and custom toolbars), graphs, and table window appearance properties are removed from files when you update their data sources using this dialog.
ESRI has atrocious documentation on updating and fixing data sources, and almost everything I have read on the subject is almost what I am looking for, but not quite.
What I am looking for is a way to repair multiple map documents without having to specify the name of each layer that has a broken data source.
A workspace can be a folder that contains items like shapefiles, CAD files, or rasters, or it can be an Arc Info Workstation coverage, personal geodatabase, file geodatabase, connection to SDE, and so on.
It connects to about 30 layers in one of our SDE databases. Is there a way to do this without having to right-click every layer and change it individually?
The example scripts in the Resource Center all involved changing a single file.
To preserve these, update the data sources in Arc Map instead. The data source is changed, but (at least in the case of an SDE connection) the link is changed to a "database connection", i.e.
the layer isn't being pointed to any longer, which breaks the link.import arcpy mxd = arcpy.mapping.
With a little Python magic, we were able to process a whole directory tree at once by using the function.
Situation: I am working on creating a Python script that will replace workspace paths for every layer in a map document in order to fix broken layers after a data migration.