I am trying to automate configuring popups with Python CIM for many points in ArcGIS Pro. I only want one field displayed, and not all of them, when I click the point with the info button. That's it. I am new to using Python CIM with arcpy.
I tried the following code and it did not work:
import arcpy
p = arcpy.mp.ArcGISProject('current')
m = p.listMaps()[0]
l = m.listLayers()[0]
l_cim = l.getDefinition('V2')
for l in m.listLayers():
l_cim = l.getDefinition('V2')
MediaObj = arcpy.cim.CreateCIMObjectFromClassName('CIMTableMediaInfo', 'V2')
MediaObj.fields = ["Field"]
l_cim.popupInfo = MediaObj
l.setDefinition(l_cim)
Please let me know where my understanding has failed.