mxd = arcpy.mapping.MapDocument(r"KabelsenLeidingen.mxd") for layer in arcpy.mapping.ListLayers(mxd): newDBPath="" newDBPath=findNewPath(layer.dataSource,layer.workspacePath) if newDBPath!="not found": layer.replaceDataSource(newDBconnection,"SDE_WORKSPACE",newDBPath,False) mxd.save()
Solved! Go to Solution.
It would be nice to see the functions as well.
What is the value of your newDBPath? They should be just the name of the dataset, not the data source. Perhaps you could change the value to equal layer.datasetName.
Jeff
GEONAM_BDMSNRSNRGRD GEONAM_BDMSNRGRNDCONVRNVLK GEONAM_WTRSANCONGRDWTRVLK newDBconnection="Database Connections\\xyz@geooraont.sde\\"