AnsweredAssumed Answered

Repoint Layer from Mapped Drive to UNC Path with Arcpy?

Question asked by mbabinski1988 on Nov 29, 2016
Latest reply on Nov 29, 2016 by rastrauch



I'm using ArcGIS Desktop 10.3.1 in a Citrix environment. I am working on a script that will automate preparing an MXD to publish as a service. One of the requirements is that all our layers point to UNC path data sources, but all of our corporate data is managed using mapped letter drives. So I need to repoint the layers.


I have folder connections to the data source using the mapped letter drive and the UNC path. However, when I use the "Set Data Source" method from the layer properties, it stays mapped to the letter drive path!


So, I used arcpy mapping to create a layer object for that layer, and use the findAndReplaceWorkspacePath and replaceDataSource method to try to point it to the UNC path. No dice: the path still has the mapped letter drive and not the UNC path.


Then I tried a workaround. I created a new, empty file geodatabase and exported all of the layers in my map to that workspace. Then I closed the map document and deleted the file geodatabase. I opened up the map (all the layers were broken) and repointed to the UNC path. Finally, that worked.


However, when I try to replicate that workflow in arcpy, I wind up with mapped letter drives in the workspace path again. Any suggestions on how to resolve this?


If not, perhaps you could go to this idea and upvote it! This seems like a pretty significant bug.