Trying to update data source for layers in ArcGIS Pro maps programmatically. So, I must be misunderstanding the syntax for doing that explained here. Because the following does not work:
aprx = arcpy.mp.ArcGISProject(r'path to my project file')
#This gets me list of all the maps
maplist = aprx.listMaps()
#If I only want those belonging to MyGroup
mygroup = aprx.listMaps('MyGroup')
#To get the layers in that group
grouplayers = mygroup.listLayers()
new_sdeConn = r'path to my SDE connection file'
for lyr in grouplayers:
old = lyr.connectionProperties #also tried lyr.connectionProperties['connection_info']
This doesn't throw an error. it just doesn't do update the data sources as desired. The ESRI example goes like:
Does this maybe only work for the project as a whole?