I have found some examples of how to iterate through the contents of a Feature Class. However, this does not work for a Feature Layer:
import arcpy
import arcgis
from arcgis.gis import GIS
gis = GIS(None, arcgis_usr, arcgis_pw, verify_cert = False)
search_result = gis.content.search("ArcGIS_content", "Feature Class")
item = search_result[0]
FeatureLayer = item.layers[0]
with arcpy.da.SearchCursor(FeatureLayer, ["OID@"]) as cursor:
for row in cursor:
attachments_list = FeatureLayer.attachments.get_list(oid = row[0])
if len(attachments_list) >= 1:
print("Found", str(len(attachments_list)), "attachments")
Is there an efficient way to do what I tried here with a FeatureLayer; namely, to iterate through all of its features (in my case point features) and extract information (the idea is to download the attachments and save coordinates and some other attribute values)?