I was able to get this working on ArcGIS Pro 2.1.2 (but previous versions may work as well). It seems to only work if I run it from the command line, not from within the Pro python window. Here is the code in case anyone is trying to do something similar. This code queries a layer for a feature with a specific ID, then zooms the mapframe to the extent of the feature and outputs a PDF. import arcpy project = arcpy.mp.ArcGISProject("//mapserver/blah/Pro-workforce2.aprx") map = project.listMaps()[0] whereZoom = "BlahID = '20181520528'" layer = map.listLayers("Zoom")[0] arcpy.SelectLayerByAttribute_management(layer,"NEW_SELECTION",whereZoom) lyt = project.listLayouts()[0] mf = lyt.listElements('MAPFRAME_ELEMENT','*')[0] mf.camera.setExtent(mf.getLayerExtent(layer,True,True)) mf.zoomToAllLayers() lyt.exportToPDF("//mapserver/blah/test-%s.pdf" % whereZoom)
... View more