The Export Attachments Toolbox provides an easy solution for exporting attachments from a feature service on AGOL/Portal or from a local Geodatabase to a local folder. The Toolbox offers various export options such as distributing the exported attachments into multiple folders according to attachment attributes, adding a prefix to attachment name, and downloading the feature service from AGOL/Portal as a File Geodatabase.
If you like this toolbox I'd appreciate if you give a Kudos. Thanks! 👍
Attachments, in particular photos, are a common component in spatial data capture and management. As such, Esri’s feature classes (in Desktop environment) and hosted feature services (in AGOL/Portal environment) can be enabled to store attachments relating to individual features. The attachments are saved as Blobs in a related table, pointing to the parent feature class through a Relationship Class.
While it is possible to batch upload attachments to a feature class by using the Add Attachments Tool, the management of existing attachments in a feature class is limited:
Consequently, many users request a dedicated tool that will allow the easy export of attachments from the feature service to a local folder where they can be managed independently.
The Export Attachments Toolbox facilitates the exporting of attachments from Geodatabases or AGOL/Portal hosted feature services.
The toolbox has three tools:
When downloading attachments from a geodatabase or a hosted feature service, the user can group the attachment in separate folders based on the related feature attributes. For example, in an asset feature class with asset type associated to each attachment, the tool will download all attachments related to asset x in folder x and all attachments related to asset y in folder y, etc.
The specified group name must be entered by the user in the exact way it appears in the feature class. If the group name is not found as a field in the feature class, the attachments will be downloaded to a folder named ‘No Group Assigned’.
When downloading attachments, the user can specify an attachment prefix that will be added to the attachment’s name. The prefix can be one of the following:
Attached in this blog is a version of the toolbox with the scripts embedded ('imported'). To view the script, right click on the script in Pro and click 'Edit'.
To use the Export Hosted Feature Layer & Attachments tool make sure you have the appropriate permissions to download hosted feature services or attachments from AGOL/Portal. If you cannot see the ‘Export’ button in the service’s overview page in your AGOL you will not be able to download it with the tool.
If your Portal has a proxy you will need to provide the tool with proxy host name and port number.
The toolbox was created in an ArcGIS Pro 2.6.3 / Python 3.6.10 environment. For best results, run the tools in a similar or upgraded environment. Using previous versions, especially Python 2 versions, is likely to cause the toolbox to encounter errors.
This toolbox is not an official Esri toolbox. It is therefore not supported or updated.
Published by Uri Gilad, 25 June 2021
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.