I would like to ask you about help. Maybe you have some solutions already. How could I export/extract few attachments for selected features from geodatabase? I tried use python scripts but no results. Thanks for help.
Attached is a zip file that contains a toolbox with a GP tool you can run to export the attachments.
Here is an example how to do this using python:
import os, arcpy
tbl = r"C:\Temp\Python\Test.gdb\Graffiti__ATTACH"
fldBLOB = 'DATA'
fldAttName = 'ATT_NAME'
outFolder = r"C:\Temp\Python\Attachments"
with arcpy.da.SearchCursor(tbl,[fldBLOB,fldAttName]) as cursor:
for row in cursor:
binaryRep = row
fileName = row
# save to disk
open(outFolder + os.sep + fileName, 'wb').write(binaryRep.tobytes())
How should I excute it? I`m not good of using scripts.
I get something like this.
I change in script "GlobalID" for "ATTACHMENTID" and it worked. Thank you Jake for your help.
This script worked beautifully except for one thing that I need. Is there anyway to augment the script to change the name of the file to a parcel number in a related table or to include the parcel number in the attributes for the exported file? Thank you for your help!
If the parcel number is in the feature class, then this would easy to do simply by updating the SearchCursor. If the parcel number is in a related table, it would require a lot more coding to obtain this value. I found the following post that may be of some help:
Select Related Records
Retrieving data ...