We ran into the same issues that others have had. I'll post some Python below that I was able to use in a couple script tools to create a workaround. Export Attachments with photo names as they are when survey form is submitted import arcpy from arcpy import da import os inTable = arcpy.GetParameterAsText(0) #Attachment Table fileLocation = arcpy.GetParameterAsText(1) #Output Folder Location with da.SearchCursor(inTable, ['DATA', 'ATT_NAME', 'ATTACHMENTID']) as cursor: for item in cursor: attachment = item[0] filenum = "Desired Prefix" filename = filenum + str(item[1]) open(fileLocation + os.sep + filename, 'wb').write(attachment.tobytes()) del item del filenum del filename del attachment Export Attachments and rename photos based on a field in your Survey 123 / Collector feature service # imports the necessary modules to run import arcpy import os import re attachTable = arcpy.GetParameterAsText(0) # table in GDB holding attachments origTable = arcpy.GetParameterAsText(1) # layer in GDB holding features to which attachments belong fileLocation = arcpy.GetParameterAsText(2) # folder where you want to save the photos nameField = arcpy.GetParameterAsText(3) # field in origTable that contains more appropriate name for attachment origFieldsList = ["GlobalID", "OBJECTID", nameField] # GlobalID for linking, OBJECTID for renaming, nameField for renaming # Use list comprehension to build a dictionary from a da SearchCursor valueDict = {r[0]:(r[1:]) for r in arcpy.da.SearchCursor(origTable, origFieldsList)} # REL_GLOBALID # 'sc_portal_map_ld_globalid_2' # GlobalID that links to origTable # create the cursor to search through the attachment tables; specify you only wish to search those three fields with arcpy.da.SearchCursor(attachTable,['DATA', 'ATT_NAME', 'ATTACHMENTID', 'REL_GLOBALID']) as cursor: for item in cursor: attachment = item[0] # attachment data filenum = "ATT" + str(item[2]) + "_" filename = filenum + str(item[1]) # this will be the filename if linking fails # store the Join value of the row being updated in a keyValue variable keyValue = item[3] # REL_GLOBALID # verify that the keyValue is in the Dictionary if keyValue in valueDict: # transfer the values stored under the keyValue from the dictionary to the updated fields. obID = valueDict[keyValue][0] # remove invalid filename characters, replace spaces and periods, limit length namefield = re.sub('[^0-9a-zA-Z]+', '_', valueDict[keyValue][1])[:18] # Create a unique filename ObjectID_AttachmentID_namefield.ext ext = filename.rsplit('.', 1)[-1] # keep extension of original file attachmentprefix = "Desired Prefix" filename = "{}_{}_{}.{}".format(namefield,attachmentprefix,item[2],ext,) print "Writing: {}{}{}".format(fileLocation, os.sep, filename) open(fileLocation + os.sep + filename, 'wb').write(attachment.tobytes()) del item del filenum del filename del attachment del valueDict print "Done"
... View more