AnsweredAssumed Answered

Export pop-up info with attachment from geodatabase

Question asked by cbowles on Jan 23, 2019
Latest reply on Jan 24, 2019 by LanceCole

Hello. We have been provided a geodatabase containing a point feature class and related attachments and tables. I have successfully exported the attached images from the geodatabase with the specified naming scheme. However, the question came up about whether it is possible to export attachments from the geodatabase, but this time INCLUDE the pop-up info (i.e., attribute data) in the "properties" of the image file. As an example, say an image of manhole 1_WW currently shows the xy location of the point, but it does not include any of the information that was added to the point feature class such as type, diameter, depth, etc, all of which are in the attribute table of the point.

I appreciate your help. Thank you.

 

Here is the script I used:

import arcpy
from arcpy import da
import os

inTable = arcpy.GetParameterAsText(0)
fileLocation = arcpy.GetParameterAsText(1)

with da.SearchCursor(inTable, ['DATA', 'ATT_NAME', 'REL_GLOBALID']) as cursor:
    for item in cursor:
        attachment = item[0]
        filenum = "ATT" + str(item[2]) + "_"
        filename = filenum + str(item[1])
        open(fileLocation + os.sep + filename, 'wb').write(attachment.tobytes())

Outcomes