I have an .mxd that I use as a template in ArcMap 10.8. I currently manually update the data source for certain layers in the MXD. I am trying to create an arcpy script to do this for me but am stuck at the part of how to change the data source for these layer(s).
I believe that I need to first determine the source of the layers I am changing and then use that to change the other layers with that same source. I need to do this as sometimes my template sources get changed by accident so I cannot put a set path in my script. I am just unsure of how to determine the source of a layer and how to change it and the source of the other layers in my MXD that have the same found source.
Here is a picture of the layers I change.
The application Tenure layer is a polygon fc and tenure road application layer, Pofc and PofT layers (all have the same source) are line fc's. If someone could just help me with the code to find the source of one of the layers, I can figure out the loop to select which layer to find the source from. And I could also use some help on how to replace the source of other layers with that source. I believe I have to use:
Layer.replaceDataSource(workspace_path, workspace_type, dataset_name, {validate})
If yes, I am unsure of how to use it.
