This is a duplicate of this issue posted in 2017: https://community.esri.com/t5/python-questions/fieldinfo-getvisible-method-returns-quot-visible/td-p/192738
Bug report here: https://support.esri.com/en/bugs/nimbus/TklNMTAxNDA4
I need to publish a webmap to Online from Pro with hundreds of layers. In Pro, I need to turn the "Shape" field visible, since I can't publish as a Webmap unless the Shape fields are visible.
So, I tried to use arcpy to turn the "Shape" fields visibility to "VISIBLE"
for m in aprx.listMaps():
for lyr in m.listLayers():
if not lyr.isGroupLayer:
desc = arcpy.Describe(lyr)
for i in range(0,desc.fieldInfo.count):
if desc.fieldInfo.getFieldName(i) == "Shape":
print(desc.fieldInfo.getVisible(i))
This returns VISIBLE for all "Shape" fields in all layers, even if they're not in Fields view.
Any way to avoid going through each layer and updating visibility by hand?
The bug report indicates that it was updated last week, but it doesn't seem like there's any plan to fix this.