Hi i have a Python Question, sorry if this is really easy (or impossible)
I've got alot of ArcGIS online photos to extract and want to give them a name them from the feature class, not from the relationship table.
(if i could have added a field in the table it would be easy but the Basic version of ArcGIS doesnt allow me to edit tables with relationship classes).
Is there a way to tweak the python script below to instead of naming it as a combination of ATT_NAME and Global ID, that i could tell it to lookup the global id of the attachments table (Sample_Locations_ATTACH) to matching global ID in the point feature class (Sample_Locations) and name the photo as a field called Sample_ID + ATT_NAME?
Cheers,
Stef
import os, arcpy
tbl = arcpy.GetParameterAsText(0)
fldBLOB = 'DATA'
fldAttName = 'ATT_NAME'
outFolder = arcpy.GetParameterAsText(1)
with arcpy.da.SearchCursor(tbl,[fldBLOB,fldAttName, "GLOBALID"]) as cursor:
for row in cursor:
binaryRep = row[0]
fileName = row[1].split(".")[0]
extension = row[1].split(".")[1]
# save to disk
open(outFolder + os.sep + fileName + "_{0}.{1}".format(row[2], extension), 'wb').write(binaryRep.tobytes())
del cursor
There is a sample that can be found here. https://community.esri.com/message/530702?commentID=530702#comment-401895 I suppose it can be adapted to your needs.