AnsweredAssumed Answered

How to set a layer service property 'version' in a map document

Question asked by tedrakel_power on Oct 9, 2018

I'm using Arc GIS 10.2.1.  I have an mxd with several layers that come from a versioned feature class in SDE.  I want to change the version that these layers point to.  I can use the following code to get the version, but I don't know how to change it.  Can I do this using arcpy?


MXD = arcpy.mapping.MapDocument("C:\temp\Test.mxd")
for lyr in arcpy.mapping.ListLayers(MXD):
   if lyr.supports("SERVICEPROPERTIES"):
      if 'Version' in layer.serviceProperties.keys():
         version = layer.serviceProperties['Version']
         print version