The geodatabase attachment tools offer a flexible environment for batch processing of attachments. The attachment geoprocessing tools should be used when a large number of files need to be attached in a bulk operation. Additionally, there are tools that provide the ability to process individual attachments available through ArcGIS Desktop.
There are two common scenarios for working with the attachment tools. In the first scenario, the attachment tools work by using a lookup table called a Match Table to associate individual files on your computer to individual rows in the input table or feature class. In the second scenario the input table or feature class already has an attribute field containing file paths or names that point to files on your computer. For both scenarios, attachments will need to be enabled on the input table or feature class. Enabling attachments creates the necessary system tables and relationships used by ArcGIS to manage attachments. This can be done using the Enable Attachments tool or by right-clicking the table or feature class and using the Manage context menu.
Example 1: Adding attachments using a match table
After enabling attachments on the input table or feature class, run the Generate Attachment Match Table tool to create a match table that will assist you in associating the records from the input table with files on disk. Input to this tool consists of an Input Folder which contains the files to be attached and a Key Field. The tool works by iterating through each row in the input table and comparing the value from that row's Key Field to all of the files in the Input Folder. A match is found when the base name (file name without file extension) for the file matches the value in the key field. The output created contains a field named MATCHID (the ObjectID from the input table or feature class) and a field named FILENAME (the file path to the matched file).
After generating the attachment match table, use the Add Attachments tool to attach the files to the records in the input dataset. The Add Attachments tool compares the values of the Input Join Field from the input table or feature class to the Match Join Field from the Match Table. If these two values are equal the file found in the Match Path Field in the match table is added to the input table or feature class as an attachment.
Note:
While recommended, it is not mandatory to use the Generate Attachment Match Table tool to create your match table. If your input dataset does not contain a usable key field, it is possible to create a match table manually through an edit session or automatically using a custom script that suits your data. The match table simply needs to have two attribute fields: a field that contains the paths or names of attachment files on your computer, and a field that contains values that can be used to join your match table to the input table or feature class.
Example 2: Adding attachments without a separate match table
After enabling attachments you may be able to use your input table or feature class to add attachments, without needing a separate match table. If the input table already contains a field with paths to the files you want to attach, it is possible to use this table exclusively without the need for a separate match table. Use the Add Attachments tool, specify the same table or feature class for both the Input Dataset as well as the Match Table, and specify the Match Path Field (field containing file paths or names of attachment files) from the input dataset.