Is it possible to change the data source of an MXD to another SDE geodatabase? I've tried this, but have only been able to get this to work when switching versions within the same SDE geodatabase. Ex:import arcpy
from arcpy import env
env.workspace = workspace = r"C:\temp\python"
env.overwriteOutput = True
mxdList = arcpy.ListFiles("*.mxd")
for mxd in mxdList:
mxd2 = workspace + "\\" + mxd
mapdoc = arcpy.mapping.MapDocument(mxd2)
mapdoc.findAndReplaceWorkspacePaths(r"C:\TEMP\Python\VECTOR_Default.sde", r"C:\TEMP\Python\VECTOR_QAQC.sde")
mapdoc.save()
del mapdoc
The above code works as I am switching from one version (SDE.Default) to another version (SDE.QAQC) within the same VECTOR geodatabase. When I try to switch to another SDE geodatabase that contains the same feature class (same owner and feature class name, just different database), it does not work. Ex:import arcpy
from arcpy import env
env.workspace = workspace = r"C:\temp\python"
env.overwriteOutput = True
mxdList = arcpy.ListFiles("*.mxd")
for mxd in mxdList:
mxd2 = workspace + "\\" + mxd
mapdoc = arcpy.mapping.MapDocument(mxd2)
mapdoc.findAndReplaceWorkspacePaths(r"C:\TEMP\Python\VECTOR_Default.sde", r"C:\TEMP\Python\RASTER_Default.sde")
mapdoc.save()
del mapdoc
Thanks for any suggestions!