{"id":1754342,"date":"2023-01-13T13:00:01","date_gmt":"2023-01-13T21:00:01","guid":{"rendered":"https:\/\/www.esri.com\/arcgis-blog\/?post_type=blog&#038;p=1754342"},"modified":"2025-05-14T07:41:29","modified_gmt":"2025-05-14T14:41:29","slug":"create-your-own-geoprocessing-tool-to-download-attachments","status":"publish","type":"blog","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/data-management\/create-your-own-geoprocessing-tool-to-download-attachments","title":{"rendered":"Create your own geoprocessing tool to download attachments"},"author":313872,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","format":"standard","meta":{"_acf_changed":false,"_searchwp_excluded":""},"categories":[23851],"tags":[762502,24341,649691,30981],"industry":[],"product":[36561],"class_list":["post-1754342","blog","type-blog","status-publish","format-standard","hentry","category-data-management","tag-attachments","tag-python","tag-python-scripts","tag-script-tools","product-arcgis-pro"],"acf":{"authors":[{"ID":313872,"user_firstname":"Mike","user_lastname":"Jensen","nickname":"Mike Jensen","user_nicename":"mike-jensen","display_name":"Mike Jensen","user_email":"mjensen@esri.com","user_url":"","user_registered":"2022-06-27 18:39:54","user_description":"Mike loves to enhance the customer experience when working with Esri software, and has many opportunities to continue this passion as a product engineer on the Geodatabase Team. Outside of his GIS profession, he loves to tinker with tech gadgets, beat on the drums, bake pies and brownies, tell and snicker at dad jokes, and enjoy quiet time in the country with family and friends.","user_avatar":"<img data-del=\"avatar\" src='https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/07\/Mike_Green_Santa_Nov_2016-204x200.jpg' class='avatar pp-user-avatar avatar-96 photo ' height='96' width='96'\/>"}],"short_description":"Learn how to create a geoprocessing tool to download and rename attachments from feature classes in a file, mobile, or enterprise geodatabase.","flexible_content":[{"acf_fc_layout":"image","image":{"ID":2772972,"id":2772972,"title":"UPDATE_STAMP","filename":"UPDATE_STAMP.png","filesize":21987,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2023\/01\/UPDATE_STAMP.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/data-management\/create-your-own-geoprocessing-tool-to-download-attachments\/update_stamp","alt":"Update stamp","author":"313872","description":"","caption":"","name":"update_stamp","status":"inherit","uploaded_to":1754342,"date":"2025-04-24 21:26:31","modified":"2025-04-24 21:26:51","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":949,"height":261,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2023\/01\/UPDATE_STAMP-213x200.png","thumbnail-width":213,"thumbnail-height":200,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2023\/01\/UPDATE_STAMP.png","medium-width":464,"medium-height":128,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2023\/01\/UPDATE_STAMP.png","medium_large-width":768,"medium_large-height":211,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2023\/01\/UPDATE_STAMP.png","large-width":949,"large-height":261,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2023\/01\/UPDATE_STAMP.png","1536x1536-width":949,"1536x1536-height":261,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2023\/01\/UPDATE_STAMP.png","2048x2048-width":949,"2048x2048-height":261,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2023\/01\/UPDATE_STAMP-826x227.png","card_image-width":826,"card_image-height":227,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2023\/01\/UPDATE_STAMP.png","wide_image-width":949,"wide_image-height":261}},"image_position":"center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"sidebar","content":"<p style=\"text-align: center\">Good news! This sample tool has been implemented as a fully supported tool in ArcGIS Pro 3.3. <a href=\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/data-management\/introduction-to-the-export-attachments-geoprocessing-tool\/\">Learn more about the new Export Attachments tool in this blog.<\/a><\/p>\n<p style=\"text-align: center\">We hope this blog is still helpful in providing examples and ideas for your data management projects and workflows.<\/p>\n<p>&nbsp;<\/p>\n<h4 style=\"text-align: center\">Additional Update!<\/h4>\n<p style=\"text-align: center\">The Download Attachments sample tool was recently updated with a user idea. The new sample tool can export the attachment type needed. For example, if you only want to download PDF attachments, check the last checkbox on the updated tool interface and enter .pdf in the added parameter text line. It will then download only .pdf attachments instead of all attachment file types. If you have .pdf files or other files such as Word (.docx) files etc., give it a try. You can check the ATTACH table for your file types in the ATT_NAME column.<\/p>\n<p style=\"text-align: center\"><strong><a href=\"https:\/\/www.arcgis.com\/home\/item.html?id=687f013c29624b4aa11ebfb50f65fbf1\">Download the updated sample tool.<\/a><\/strong><\/p>\n","image_reference":false,"layout":"standard","image_reference_figure":"","snippet":"","spotlight_name":"","section_title":"","position":"Center","spotlight_image":false},{"acf_fc_layout":"content","content":"<p>After years of teaching instructor-led classes and covering courses for geodatabases and Python automation, I was excited to recently join the geodatabase team to share new ways to assist our users with their workflows and projects. I know that students love examples, especially sample code and demonstrations when it comes to automating manual workflows with Python scripting.<\/p>\n<p>Geodatabases have supported the ability to enable feature classes (including stand-alone tables) to <a href=\"https:\/\/pro.arcgis.com\/en\/pro-app\/latest\/tool-reference\/data-management\/add-attachments.htm\">add attachments<\/a> for many years. Attachments are one way to associate nongeographic data with geographic data. An example is attaching one or more pictures to a feature in a feature class. When enabled and attachments added, a user can mouse click on a feature to display a pop-up window showing its attributes and associated media data. <a href=\"https:\/\/community.esri.com\/t5\/arcgis-pro-ideas\/batch-attachment-export\/idi-p\/969037\">GIS users have asked<\/a> if it is possible to download attachments from an enabled feature class to a specified location along with options to rename the exported files.<\/p>\n"},{"acf_fc_layout":"image","image":{"ID":1754862,"id":1754862,"title":"ArcGISPro_Pop-upWindow_w_attachment2","filename":"ArcGISPro_Pop-upWindow_w_attachment2.png","filesize":34633,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/10\/ArcGISPro_Pop-upWindow_w_attachment2.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/data-management\/create-your-own-geoprocessing-tool-to-download-attachments\/arcgispro_pop-upwindow_w_attachment2","alt":"ArcGIS Pro Pop-up window displaying image attachment with select attributes.","author":"313872","description":"","caption":"","name":"arcgispro_pop-upwindow_w_attachment2","status":"inherit","uploaded_to":1754342,"date":"2022-10-31 20:06:58","modified":"2022-11-02 14:48:10","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":314,"height":415,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/10\/ArcGISPro_Pop-upWindow_w_attachment2-213x200.png","thumbnail-width":213,"thumbnail-height":200,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/10\/ArcGISPro_Pop-upWindow_w_attachment2.png","medium-width":197,"medium-height":261,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/10\/ArcGISPro_Pop-upWindow_w_attachment2.png","medium_large-width":314,"medium_large-height":415,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/10\/ArcGISPro_Pop-upWindow_w_attachment2.png","large-width":314,"large-height":415,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/10\/ArcGISPro_Pop-upWindow_w_attachment2.png","1536x1536-width":314,"1536x1536-height":415,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/10\/ArcGISPro_Pop-upWindow_w_attachment2.png","2048x2048-width":314,"2048x2048-height":415,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/10\/ArcGISPro_Pop-upWindow_w_attachment2.png","card_image-width":314,"card_image-height":415,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/10\/ArcGISPro_Pop-upWindow_w_attachment2.png","wide_image-width":314,"wide_image-height":415}},"image_position":"right","orientation":"vertical","hyperlink":""},{"acf_fc_layout":"content","content":"<p>With a <a href=\"https:\/\/pro.arcgis.com\/en\/pro-app\/latest\/tool-reference\/data-management\/an-overview-of-the-attachments-toolset.htm\">suite of data management geoprocessing tools to manage, maintain, and work with attachments<\/a>, it is still possible to discover that the tool you need doesn\u2019t currently exist. For example, there is not a Download Attachments tool. With a do-it-yourself (DIY) enthusiasm, I\u2019ll show you how to create your own custom data management geoprocessing tool using <a href=\"https:\/\/pro.arcgis.com\/en\/pro-app\/latest\/arcpy\/get-started\/what-is-arcpy-.htm\">ArcPy<\/a> and ArcGIS Pro script tools. The tool will allow you to quickly download attachments and optionally rename them without manually accessing and saving one attachment at a time.<\/p>\n<h2>Let&#8217;s get started<\/h2>\n<p>To create your own data management tool, you\u2019ll do it in two parts.<\/p>\n<ol>\n<li><a href=\"https:\/\/pro.arcgis.com\/en\/pro-app\/latest\/arcpy\/get-started\/installing-python-for-arcgis-pro.htm\">Write a Python script<\/a> to download all attachments to a specified location. Provide options to download attachments to sub-folders, and options to rename the files using selected field values.<\/li>\n<li>Design and <a href=\"https:\/\/pro.arcgis.com\/en\/pro-app\/latest\/help\/analysis\/geoprocessing\/basics\/create-a-python-script-tool.htm\">create the script tool<\/a> (geoprocessing tool) interface and associate the parameters of the tool with specific lines in the script. Make the tool smart by implementing <a href=\"https:\/\/pro.arcgis.com\/en\/pro-app\/latest\/arcpy\/geoprocessing_and_python\/customizing-script-tool-behavior.htm\">tool behavior<\/a>.<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<h2>Key Script functions<\/h2>\n<p>Let\u2019s begin with key items to do the work when you click the tool&#8217;s <span style=\"font-weight: normal !msorm\"><strong>Run<\/strong><\/span> button. You want your script to do the following:<\/p>\n<ol>\n<li>Determine if the feature class has been <a href=\"https:\/\/pro.arcgis.com\/en\/pro-app\/latest\/tool-reference\/data-management\/enable-attachments.htm\">enabled for attachments<\/a>.<\/li>\n<li>Verify that the feature class has attachments to download.<\/li>\n<li>Select the output folder location path to download the attachments.<\/li>\n<li>Optionally, allow the user to download attachments to sub-folders. The values in the selected field name, create the Sub-folder name.<\/li>\n<li>Optionally, allow the user to rename the attachments with values in selected attribute fields.<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n"},{"acf_fc_layout":"content","content":"<h2>Writing the Python script<\/h2>\n<h3>Part 1<\/h3>\n<p>The following static code snippet gives you a glimpse of how you will check to make sure the selected feature class has been enabled for attachments using the <a href=\"https:\/\/pro.arcgis.com\/en\/pro-app\/latest\/arcpy\/functions\/describe.htm\">arcpy Describe function<\/a>. You will also use the Describe function to return the associated ATTACH table. This table stores your attachments in the DATA column as binary large objects (BLOB data). If the ATTACH table is empty, your tool will notify the user that the selected feature class has no attachments to download with an <a href=\"https:\/\/pro.arcgis.com\/en\/pro-app\/latest\/arcpy\/functions\/adderror.htm\">error message<\/a>.<\/p>\n"},{"acf_fc_layout":"image","image":{"ID":1815232,"id":1815232,"title":"Main_Code_Snippet_Part1_Image","filename":"Main_Code_Snippet_Part1_Image-2.png","filesize":106607,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Main_Code_Snippet_Part1_Image-2.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/data-management\/create-your-own-geoprocessing-tool-to-download-attachments\/main_code_snippet_part1_image-3","alt":"Static code showing use of Describe function.","author":"313872","description":"","caption":"","name":"main_code_snippet_part1_image-3","status":"inherit","uploaded_to":1754342,"date":"2023-01-11 21:40:37","modified":"2023-01-11 21:41:03","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":939,"height":662,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Main_Code_Snippet_Part1_Image-2-213x200.png","thumbnail-width":213,"thumbnail-height":200,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Main_Code_Snippet_Part1_Image-2.png","medium-width":370,"medium-height":261,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Main_Code_Snippet_Part1_Image-2.png","medium_large-width":768,"medium_large-height":541,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Main_Code_Snippet_Part1_Image-2.png","large-width":939,"large-height":662,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Main_Code_Snippet_Part1_Image-2.png","1536x1536-width":939,"1536x1536-height":662,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Main_Code_Snippet_Part1_Image-2.png","2048x2048-width":939,"2048x2048-height":662,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Main_Code_Snippet_Part1_Image-2-660x465.png","card_image-width":660,"card_image-height":465,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Main_Code_Snippet_Part1_Image-2.png","wide_image-width":939,"wide_image-height":662}},"image_position":"center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<h2>Writing the code<\/h2>\n<h3>Part 2<\/h3>\n<p>The second portion of the script verifies if the user wants to export the attachments to subfolders or rename them. Depending on the combination of options the end user chooses most of the code is similar within a series of elif statements. One important item to note. It is possible that a feature class that has been enabled for attachments may use either the OBJECTID with the REL_OBJECTID relationship in the ATTACH table, or GLOBALID&#8217;s for feature classes enabled in newer versions of the software. The script needs to check both so that all enabled feature classes work with the tool. This means that the tool should work with any enabled attachment feature class. Checkbox false on all options will download all attachments with their original names to the output folder only.<\/p>\n"},{"acf_fc_layout":"image","image":{"ID":1801762,"id":1801762,"title":"Main_Code_Snippet_Part2_Image","filename":"Main_Code_Snippet_Part2_Image-1.png","filesize":162572,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Main_Code_Snippet_Part2_Image-1.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/data-management\/create-your-own-geoprocessing-tool-to-download-attachments\/main_code_snippet_part2_image-2","alt":"","author":"313872","description":"","caption":"","name":"main_code_snippet_part2_image-2","status":"inherit","uploaded_to":1754342,"date":"2022-12-20 19:03:49","modified":"2022-12-20 19:03:49","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":964,"height":1188,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Main_Code_Snippet_Part2_Image-1-213x200.png","thumbnail-width":213,"thumbnail-height":200,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Main_Code_Snippet_Part2_Image-1.png","medium-width":212,"medium-height":261,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Main_Code_Snippet_Part2_Image-1.png","medium_large-width":768,"medium_large-height":946,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Main_Code_Snippet_Part2_Image-1.png","large-width":876,"large-height":1080,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Main_Code_Snippet_Part2_Image-1.png","1536x1536-width":964,"1536x1536-height":1188,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Main_Code_Snippet_Part2_Image-1.png","2048x2048-width":964,"2048x2048-height":1188,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Main_Code_Snippet_Part2_Image-1-377x465.png","card_image-width":377,"card_image-height":465,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Main_Code_Snippet_Part2_Image-1-876x1080.png","wide_image-width":876,"wide_image-height":1080}},"image_position":"center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<p>With your code completed and tested successfully, you can move on to designing your own script tool with a user-friendly interface to interact with the code. You can download a copy of the completed sample script later in this blog.<\/p>\n<p>If you think that writing code is fun, you\u2019ll probably also like creating your geoprocessing tool interface with a custom <a href=\"https:\/\/pro.arcgis.com\/en\/pro-app\/latest\/arcpy\/geoprocessing_and_python\/a-quick-tour-of-creating-script-tools.htm\">script tool<\/a> inside of ArcGIS Pro.<\/p>\n"},{"acf_fc_layout":"content","content":"<h2>Creating the script tool<\/h2>\n<p>Create <a href=\"https:\/\/pro.arcgis.com\/en\/pro-app\/latest\/arcpy\/geoprocessing_and_python\/a-quick-tour-of-creating-script-tools.htm\">script tools<\/a> in an ArcGIS Pro project default <a href=\"https:\/\/pro.arcgis.com\/en\/pro-app\/latest\/help\/projects\/connect-to-a-toolbox.htm\">toolbox<\/a> or a custom one of your own.<\/p>\n<ol>\n<li>Right-click the toolbox, select <span style=\"font-weight: normal !msorm\"><strong>New<\/strong><\/span>, and select <span style=\"font-weight: normal !msorm\"><strong>Script<\/strong><\/span>.<\/li>\n<\/ol>\n"},{"acf_fc_layout":"image","image":{"ID":1754942,"id":1754942,"title":"RightClick_New_Script","filename":"RightClick_New_Script.png","filesize":12817,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/10\/RightClick_New_Script.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/data-management\/create-your-own-geoprocessing-tool-to-download-attachments\/rightclick_new_script","alt":"Create new script tool from Catalog pane","author":"313872","description":"","caption":"","name":"rightclick_new_script","status":"inherit","uploaded_to":1754342,"date":"2022-10-31 20:29:09","modified":"2022-10-31 20:30:10","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":513,"height":216,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/10\/RightClick_New_Script-213x200.png","thumbnail-width":213,"thumbnail-height":200,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/10\/RightClick_New_Script.png","medium-width":464,"medium-height":195,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/10\/RightClick_New_Script.png","medium_large-width":513,"medium_large-height":216,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/10\/RightClick_New_Script.png","large-width":513,"large-height":216,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/10\/RightClick_New_Script.png","1536x1536-width":513,"1536x1536-height":216,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/10\/RightClick_New_Script.png","2048x2048-width":513,"2048x2048-height":216,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/10\/RightClick_New_Script.png","card_image-width":513,"card_image-height":216,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/10\/RightClick_New_Script.png","wide_image-width":513,"wide_image-height":216}},"image_position":"center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<p style=\"padding-left: 80px\">2. In the new <b>s<\/b><b>cript<\/b> properties window, on the <span style=\"font-weight: normal !msorm\"><strong>General<\/strong><\/span> tab, give the tool a name and label. The label will be the name that shows up on the tool. The name and label can be the same, but the name cannot have spaces. Provide a brief description about the tool. When a user hovers the mouse over the question mark (?) icon at the top right of the tool, the software will show a text window with the description.<\/p>\n"},{"acf_fc_layout":"image","image":{"ID":1795222,"id":1795222,"title":"ToolProperties_GeneralTab_DownloadAttFinal","filename":"ToolProperties_GeneralTab_DownloadAttFinal.png","filesize":29757,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/ToolProperties_GeneralTab_DownloadAttFinal.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/data-management\/create-your-own-geoprocessing-tool-to-download-attachments\/toolproperties_generaltab_downloadattfinal","alt":"Tool Properties General Tab information.","author":"313872","description":"","caption":"","name":"toolproperties_generaltab_downloadattfinal","status":"inherit","uploaded_to":1754342,"date":"2022-12-13 23:16:47","modified":"2022-12-20 17:37:54","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":1164,"height":544,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/ToolProperties_GeneralTab_DownloadAttFinal-213x200.png","thumbnail-width":213,"thumbnail-height":200,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/ToolProperties_GeneralTab_DownloadAttFinal.png","medium-width":464,"medium-height":217,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/ToolProperties_GeneralTab_DownloadAttFinal.png","medium_large-width":768,"medium_large-height":359,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/ToolProperties_GeneralTab_DownloadAttFinal.png","large-width":1164,"large-height":544,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/ToolProperties_GeneralTab_DownloadAttFinal.png","1536x1536-width":1164,"1536x1536-height":544,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/ToolProperties_GeneralTab_DownloadAttFinal.png","2048x2048-width":1164,"2048x2048-height":544,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/ToolProperties_GeneralTab_DownloadAttFinal-826x386.png","card_image-width":826,"card_image-height":386,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/ToolProperties_GeneralTab_DownloadAttFinal.png","wide_image-width":1164,"wide_image-height":544}},"image_position":"center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<p style=\"padding-left: 80px\">3. Click the <strong>Parameters<\/strong> tab in the <span style=\"font-weight: normal !msorm\"><strong>Tool Properties<\/strong><\/span> window to create and add each tool parameter. This section is where you design the user interface of your tool. Users choose the feature class, and output folder as required parameters. Optionally, they can store the attachments in sub-folders in the output folder using field values. Field values can also be used to rename exported attachments.<\/p>\n"},{"acf_fc_layout":"image","image":{"ID":1795002,"id":1795002,"title":"ToolProperties_Parameters_Tab_withAlphaSteps_DownloadAttFinal","filename":"ToolProperties_Parameters_Tab_withAlphaSteps_DownloadAttFinal.png","filesize":69345,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/ToolProperties_Parameters_Tab_withAlphaSteps_DownloadAttFinal.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/data-management\/create-your-own-geoprocessing-tool-to-download-attachments\/toolproperties_parameters_tab_withalphasteps_downloadattfinal","alt":"Tool Properties Parameters used for tool interface.","author":"313872","description":"","caption":"","name":"toolproperties_parameters_tab_withalphasteps_downloadattfinal","status":"inherit","uploaded_to":1754342,"date":"2022-12-13 21:40:34","modified":"2022-12-20 17:38:25","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":1878,"height":531,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/ToolProperties_Parameters_Tab_withAlphaSteps_DownloadAttFinal-213x200.png","thumbnail-width":213,"thumbnail-height":200,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/ToolProperties_Parameters_Tab_withAlphaSteps_DownloadAttFinal.png","medium-width":464,"medium-height":131,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/ToolProperties_Parameters_Tab_withAlphaSteps_DownloadAttFinal.png","medium_large-width":768,"medium_large-height":217,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/ToolProperties_Parameters_Tab_withAlphaSteps_DownloadAttFinal.png","large-width":1878,"large-height":531,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/ToolProperties_Parameters_Tab_withAlphaSteps_DownloadAttFinal-1536x434.png","1536x1536-width":1536,"1536x1536-height":434,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/ToolProperties_Parameters_Tab_withAlphaSteps_DownloadAttFinal.png","2048x2048-width":1878,"2048x2048-height":531,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/ToolProperties_Parameters_Tab_withAlphaSteps_DownloadAttFinal-826x234.png","card_image-width":826,"card_image-height":234,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/ToolProperties_Parameters_Tab_withAlphaSteps_DownloadAttFinal.png","wide_image-width":1878,"wide_image-height":531}},"image_position":"center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<p style=\"padding-left: 80px\">4. Add each <a href=\"https:\/\/pro.arcgis.com\/en\/pro-app\/latest\/help\/analysis\/geoprocessing\/basics\/create-a-python-script-tool.htm\">tool parameter<\/a> with its label, name, data type, type, direction, and so on.<\/p>\n<p style=\"padding-left: 120px\"><span style=\"font-weight: normal !msorm\">a. <strong>Input Feature Class<\/strong><\/span>\u2014The first parameter will allow the user to select a feature class. Note: This parameter&#8217;s data type is a feature layer, rather than a feature class. What&#8217;s the difference? Selecting <strong>Feature Layer<\/strong> allows you to pick data from the <strong>Contents<\/strong> pane of the active map or from a folder location. Another benefit of using <strong>Feature Layer<\/strong> is that it will <a href=\"https:\/\/pro.arcgis.com\/en\/pro-app\/latest\/tool-reference\/appendices\/filtered-inputs-for-geoprocessing.htm\">only export attachments for selected features<\/a> (if the selected feature has attachments). Having the data type set to <strong>Feature Class<\/strong> would only allow a user to select a feature class using the folder icon. You&#8217;ll set this parameter to be a required input.<\/p>\n<p style=\"padding-left: 120px\">b.<strong> Output Folder<\/strong>\u2014The second parameter is a required output to choose a folder to store the downloaded attachments or sub-folders with attachments if applicable.<\/p>\n<p style=\"padding-left: 120px\">c.<strong> Output attachments to subfolders<\/strong>\u2014The third parameter is an optional input to select a check box if the user wants to download the attachments to individual sub-folders based on a field value. Notice that the data type is Boolean. If checked (true), create sub-folders, otherwise load all files into a single output folder.<\/p>\n<p style=\"padding-left: 120px\">d.<strong> Subfolder names by field<\/strong>\u2014The fourth parameter is dependent on the third parameter and will only display if the optional check box is checked. If it&#8217;s checked, the user can then select a field from the feature class for the sub-folder names. (The validation script implements this behavior on the tool, which will also be available for review in a copy of the final tool).<\/p>\n<p style=\"padding-left: 120px\">e. <strong>Rename Output Filenames<\/strong> \u2013 This is another optional parameter, and if checked, will allow the user to rename the exported images based on selected field values in the feature class attribute table. Note: Renamed files will have an underscore inserted between the field values. When renaming exported attachments based on field values the tool automatically appends the AttachmentID number as the last value to avoid duplicate filenames.<\/p>\n<p style=\"padding-left: 120px\">f. <strong>Select Fields<\/strong> \u2013 This parameter will only appear if the checkbox for the Rename Output Filenames Boolean value equals true (checked). The script allows up to five field selections for renaming the exported files. The script tool validation script prevents date field selections, as the date data type was causing errors with renaming the files. If you would like to use the values from a date field, create a new text field and copy the dates to the new text field. Be aware that special characters such as slashes (&#8220;\/&#8221;) or colons and semicolons (&#8220;:&#8221;, &#8220;;&#8221;) will likely cause an operating system error when attempting to rename files or sub-folders. Consider replacing special characters with spaces, underscores or hyphens.<\/p>\n<p style=\"padding-left: 120px\">g. <strong>Keep existing filename and add field value as a prefix to filename<\/strong> \u2013 This optional parameter adds selected field values with an underscore to the beginning of the original filename.<\/p>\n<p style=\"padding-left: 120px\">h. <strong>Keep existing filename and add field value as a suffix to filename<\/strong> \u2013 This optional parameter adds selected field values with an underscore to the end of the original filename.<\/p>\n<p style=\"padding-left: 120px\">i.<strong> Output Folder Path<\/strong>\u2014The last parameter is set to derived and hidden but is added if a user wants to use the new tool in ModelBuilder. The output path will appear as a result within the model.<\/p>\n<p style=\"padding-left: 80px\">Notice that each parameter in the tool properties has a number on the left side, starting with zero. If you are thinking those are index numbers, you are correct. You will match each parameters index with updated variables in your script. The script will now use user input values instead of hard-coded values when the user clicks <strong>Run<\/strong>.<\/p>\n"},{"acf_fc_layout":"image","image":{"ID":1801602,"id":1801602,"title":"ToolProperties_IndexColumnFinal","filename":"ToolProperties_IndexColumnFinal.png","filesize":30182,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/ToolProperties_IndexColumnFinal.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/data-management\/create-your-own-geoprocessing-tool-to-download-attachments\/toolproperties_indexcolumnfinal","alt":"Tool Properties Parameters highlighting each parameters tool index number.","author":"313872","description":"","caption":"","name":"toolproperties_indexcolumnfinal","status":"inherit","uploaded_to":1754342,"date":"2022-12-20 17:13:56","modified":"2022-12-20 17:39:13","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":456,"height":407,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/ToolProperties_IndexColumnFinal-213x200.png","thumbnail-width":213,"thumbnail-height":200,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/ToolProperties_IndexColumnFinal.png","medium-width":292,"medium-height":261,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/ToolProperties_IndexColumnFinal.png","medium_large-width":456,"medium_large-height":407,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/ToolProperties_IndexColumnFinal.png","large-width":456,"large-height":407,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/ToolProperties_IndexColumnFinal.png","1536x1536-width":456,"1536x1536-height":407,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/ToolProperties_IndexColumnFinal.png","2048x2048-width":456,"2048x2048-height":407,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/ToolProperties_IndexColumnFinal.png","card_image-width":456,"card_image-height":407,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/ToolProperties_IndexColumnFinal.png","wide_image-width":456,"wide_image-height":407}},"image_position":"center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<p>Tip: You can add a <a href=\"https:\/\/pro.arcgis.com\/en\/pro-app\/latest\/help\/analysis\/geoprocessing\/basics\/document-a-custom-tool.htm\">parameter description by updating the metadata<\/a>. This allows a user to mouse-over the left side of each parameter to see descriptive information, also known as a tool tip. Right click on the script tool and select <strong>Edit Metadata<\/strong>. Under the Syntax Section select the down arrow of the parameter to update it&#8217;s description in the <strong>Dialog Explanation<\/strong> text box. When finished, click <strong>Save<\/strong> on the Metadata Ribbon.<\/p>\n"},{"acf_fc_layout":"image","image":{"ID":1758652,"id":1758652,"title":"Parameter_Metadata_Edit_View_DownloadAtt","filename":"Parameter_Metadata_Edit_View_DownloadAtt.png","filesize":9211,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Parameter_Metadata_Edit_View_DownloadAtt.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/data-management\/create-your-own-geoprocessing-tool-to-download-attachments\/parameter_metadata_edit_view_downloadatt","alt":"Script Tool Metadata Editor View","author":"313872","description":"","caption":"","name":"parameter_metadata_edit_view_downloadatt","status":"inherit","uploaded_to":1754342,"date":"2022-11-03 16:21:36","modified":"2022-11-03 16:22:19","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":578,"height":195,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Parameter_Metadata_Edit_View_DownloadAtt-213x195.png","thumbnail-width":213,"thumbnail-height":195,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Parameter_Metadata_Edit_View_DownloadAtt.png","medium-width":464,"medium-height":157,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Parameter_Metadata_Edit_View_DownloadAtt.png","medium_large-width":578,"medium_large-height":195,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Parameter_Metadata_Edit_View_DownloadAtt.png","large-width":578,"large-height":195,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Parameter_Metadata_Edit_View_DownloadAtt.png","1536x1536-width":578,"1536x1536-height":195,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Parameter_Metadata_Edit_View_DownloadAtt.png","2048x2048-width":578,"2048x2048-height":195,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Parameter_Metadata_Edit_View_DownloadAtt.png","card_image-width":578,"card_image-height":195,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Parameter_Metadata_Edit_View_DownloadAtt.png","wide_image-width":578,"wide_image-height":195}},"image_position":"center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<p>Users will see this information as tool tips when they hover their mouse over the blue &#8216;i&#8217; icon or required red asterisk at the left of each parameter.<\/p>\n"},{"acf_fc_layout":"image","image":{"ID":1758772,"id":1758772,"title":"Parameter_Metadata_Dialog_Explanation_DownloadAtt","filename":"Parameter_Metadata_Dialog_Explanation_DownloadAtt.png","filesize":29669,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Parameter_Metadata_Dialog_Explanation_DownloadAtt.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/data-management\/create-your-own-geoprocessing-tool-to-download-attachments\/parameter_metadata_dialog_explanation_downloadatt","alt":"Dialog Explanation for parameters in Script Tool Metadata Editor View","author":"313872","description":"","caption":"","name":"parameter_metadata_dialog_explanation_downloadatt","status":"inherit","uploaded_to":1754342,"date":"2022-11-03 17:05:26","modified":"2022-11-03 17:06:25","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":828,"height":144,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Parameter_Metadata_Dialog_Explanation_DownloadAtt-213x144.png","thumbnail-width":213,"thumbnail-height":144,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Parameter_Metadata_Dialog_Explanation_DownloadAtt.png","medium-width":464,"medium-height":81,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Parameter_Metadata_Dialog_Explanation_DownloadAtt.png","medium_large-width":768,"medium_large-height":134,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Parameter_Metadata_Dialog_Explanation_DownloadAtt.png","large-width":828,"large-height":144,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Parameter_Metadata_Dialog_Explanation_DownloadAtt.png","1536x1536-width":828,"1536x1536-height":144,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Parameter_Metadata_Dialog_Explanation_DownloadAtt.png","2048x2048-width":828,"2048x2048-height":144,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Parameter_Metadata_Dialog_Explanation_DownloadAtt-826x144.png","card_image-width":826,"card_image-height":144,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Parameter_Metadata_Dialog_Explanation_DownloadAtt.png","wide_image-width":828,"wide_image-height":144}},"image_position":"center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<h2>Pairing the script with the tool<\/h2>\n<p>To gather the information from what the user entered for each tool parameter, you will match the lines of code in the script with the parameter index on your new tool.<\/p>\n"},{"acf_fc_layout":"image","image":{"ID":1801652,"id":1801652,"title":"PairingScriptwithToolCodeSnippet_DownloadAttFinal","filename":"PairingScriptwithToolCodeSnippet_DownloadAttFinal.png","filesize":78270,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/PairingScriptwithToolCodeSnippet_DownloadAttFinal.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/data-management\/create-your-own-geoprocessing-tool-to-download-attachments\/pairingscriptwithtoolcodesnippet_downloadattfinal","alt":"Sample code snippet showing GetParameterAsText functions with their index number to gather user input.","author":"313872","description":"","caption":"","name":"pairingscriptwithtoolcodesnippet_downloadattfinal","status":"inherit","uploaded_to":1754342,"date":"2022-12-20 17:26:04","modified":"2022-12-20 17:40:54","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":712,"height":526,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/PairingScriptwithToolCodeSnippet_DownloadAttFinal-213x200.png","thumbnail-width":213,"thumbnail-height":200,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/PairingScriptwithToolCodeSnippet_DownloadAttFinal.png","medium-width":353,"medium-height":261,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/PairingScriptwithToolCodeSnippet_DownloadAttFinal.png","medium_large-width":712,"medium_large-height":526,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/PairingScriptwithToolCodeSnippet_DownloadAttFinal.png","large-width":712,"large-height":526,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/PairingScriptwithToolCodeSnippet_DownloadAttFinal.png","1536x1536-width":712,"1536x1536-height":526,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/PairingScriptwithToolCodeSnippet_DownloadAttFinal.png","2048x2048-width":712,"2048x2048-height":526,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/PairingScriptwithToolCodeSnippet_DownloadAttFinal-629x465.png","card_image-width":629,"card_image-height":465,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/PairingScriptwithToolCodeSnippet_DownloadAttFinal.png","wide_image-width":712,"wide_image-height":526}},"image_position":"center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<h2>Getting user input<\/h2>\n<p>Here you will replace the hard-coded lines used for testing to now gather the feature class path, the output folder path, and the status of the checkboxes from what the user entered on the user interface of the tool.<\/p>\n<ol>\n<li>Replace the feature class path with fc = arcpy.GetParameterAsText(0)\u2014with (0) matching up to the first parameter on the tool, which is also indexed 0.<\/li>\n<li>Replace the output folder path by referencing the text from the second parameter, indexed as 1. outFolder = arcpy.GetParameterAsText(1).<\/li>\n<li>SubFolderCheckbox = arcpy.GetParameterAsText(2) returns false if the user leaves it unchecked, or true if the user checks the box to download the attachments into subfolders.<\/li>\n<li>If the user does check the check box, fieldname = arcpy.GetParameterAsText(3) will return either the ObjectID field values by default, or field values from a field selected by the user. The sample script does not prevent users from selecting a date field. Instead, we prevented date fields from selection in the script tools validation script as they presented issues and errors when creating sub-folders or filenames.<\/li>\n<li>RenameCheckBox = arcpy.GetParameterAsText(4) returns false if the user leaves it unchecked, or true if the user checks the box to rename attachments when downloading.<\/li>\n<li>getFields = arcpy.GetParameterAsText(5) returns one or more fields for renaming attachments with each fields values. This parameter is set for multiple values, and when populated, each field is separated with a semi-colon.<\/li>\n<li>AddPrefixCheckbox = arcpy.GetParameterAsText(6) returns false if the user leaves it unchecked, or true if the user checks the box to rename original filenames with a prefix.<\/li>\n<li>AddSuffixCheckbox = arcpy.GetParameterAsText(7) returns false if the user leaves it unchecked, or true if the user checks the box to rename original filenames with a suffix.<\/li>\n<\/ol>\n<p>Tip: Consider commenting out the hard-coded lines and keep them in the script for reference.<\/p>\n<p>In addition, you&#8217;ll add the last parameter (hidden) to the end of the script to show an output result if a user chooses to use the tool in ModelBuilder (referencing index 8 on the tool).<\/p>\n"},{"acf_fc_layout":"image","image":{"ID":1801692,"id":1801692,"title":"PairingScriptwithToolCodeSnippet_SetParameter_DownloadAtt_Final","filename":"PairingScriptwithToolCodeSnippet_SetParameter_DownloadAtt_Final.png","filesize":16337,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/PairingScriptwithToolCodeSnippet_SetParameter_DownloadAtt_Final.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/data-management\/create-your-own-geoprocessing-tool-to-download-attachments\/pairingscriptwithtoolcodesnippet_setparameter_downloadatt_final","alt":"Sample code snippet showing the SetParameterAsText function for using the tool in ModelBuilder.","author":"313872","description":"","caption":"","name":"pairingscriptwithtoolcodesnippet_setparameter_downloadatt_final","status":"inherit","uploaded_to":1754342,"date":"2022-12-20 17:32:28","modified":"2022-12-20 17:41:38","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":729,"height":128,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/PairingScriptwithToolCodeSnippet_SetParameter_DownloadAtt_Final-213x128.png","thumbnail-width":213,"thumbnail-height":128,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/PairingScriptwithToolCodeSnippet_SetParameter_DownloadAtt_Final.png","medium-width":464,"medium-height":81,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/PairingScriptwithToolCodeSnippet_SetParameter_DownloadAtt_Final.png","medium_large-width":729,"medium_large-height":128,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/PairingScriptwithToolCodeSnippet_SetParameter_DownloadAtt_Final.png","large-width":729,"large-height":128,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/PairingScriptwithToolCodeSnippet_SetParameter_DownloadAtt_Final.png","1536x1536-width":729,"1536x1536-height":128,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/PairingScriptwithToolCodeSnippet_SetParameter_DownloadAtt_Final.png","2048x2048-width":729,"2048x2048-height":128,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/PairingScriptwithToolCodeSnippet_SetParameter_DownloadAtt_Final.png","card_image-width":729,"card_image-height":128,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/PairingScriptwithToolCodeSnippet_SetParameter_DownloadAtt_Final.png","wide_image-width":729,"wide_image-height":128}},"image_position":"center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<h2>Load the script in the script tool<\/h2>\n<p>With your script updated to gather the input from the user on the tools interface, you can save a copy of it and load the script into the tool.<\/p>\n<ol>\n<li>Go to the <strong>Execution<\/strong> tab in the <strong>Tool Properties <\/strong>window.\u00a0Browse to the location of the script file. It is highly recommended to always use a copy of your script when adding it to a script tool.<\/li>\n<li>If you plan to share this tool with others, you will need to embed the script into the tool by clicking the red toolbox script button. This will then change to a green arrow and show <strong>embedded<\/strong> in the <strong>Script File <\/strong>window.<\/li>\n<li>Further, if you want to protect the intellectual property of your code and hide it from others, you can password protect it by clicking the lock button. Note: Make sure you don\u2019t lose the password, as there is no Forgot Password option available to reset it.<\/li>\n<\/ol>\n"},{"acf_fc_layout":"image","image":{"ID":1756172,"id":1756172,"title":"Embed_Script_via_ToolboxButton_DownloadAtt","filename":"Embed_Script_via_ToolboxButton_DownloadAtt.png","filesize":3659,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Embed_Script_via_ToolboxButton_DownloadAtt.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/data-management\/create-your-own-geoprocessing-tool-to-download-attachments\/embed_script_via_toolboxbutton_downloadatt","alt":"Click Toolbox button to embed script into script tool to share with others.","author":"313872","description":"","caption":"","name":"embed_script_via_toolboxbutton_downloadatt","status":"inherit","uploaded_to":1754342,"date":"2022-11-01 16:56:39","modified":"2022-11-01 16:57:41","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":332,"height":38,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Embed_Script_via_ToolboxButton_DownloadAtt-213x38.png","thumbnail-width":213,"thumbnail-height":38,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Embed_Script_via_ToolboxButton_DownloadAtt.png","medium-width":332,"medium-height":38,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Embed_Script_via_ToolboxButton_DownloadAtt.png","medium_large-width":332,"medium_large-height":38,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Embed_Script_via_ToolboxButton_DownloadAtt.png","large-width":332,"large-height":38,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Embed_Script_via_ToolboxButton_DownloadAtt.png","1536x1536-width":332,"1536x1536-height":38,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Embed_Script_via_ToolboxButton_DownloadAtt.png","2048x2048-width":332,"2048x2048-height":38,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Embed_Script_via_ToolboxButton_DownloadAtt.png","card_image-width":332,"card_image-height":38,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Embed_Script_via_ToolboxButton_DownloadAtt.png","wide_image-width":332,"wide_image-height":38}},"image_position":"center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"image","image":{"ID":1756212,"id":1756212,"title":"ToolProperties_ExecutionTab_EmbeddedScript_DownloadAtt","filename":"ToolProperties_ExecutionTab_EmbeddedScript_DownloadAtt.png","filesize":15538,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/ToolProperties_ExecutionTab_EmbeddedScript_DownloadAtt.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/data-management\/create-your-own-geoprocessing-tool-to-download-attachments\/toolproperties_executiontab_embeddedscript_downloadatt","alt":"Tool Properties: Execution Tab showing embedded script in script tool.","author":"313872","description":"","caption":"","name":"toolproperties_executiontab_embeddedscript_downloadatt","status":"inherit","uploaded_to":1754342,"date":"2022-11-01 17:04:36","modified":"2022-12-27 23:00:55","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":1001,"height":501,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/ToolProperties_ExecutionTab_EmbeddedScript_DownloadAtt-213x200.png","thumbnail-width":213,"thumbnail-height":200,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/ToolProperties_ExecutionTab_EmbeddedScript_DownloadAtt.png","medium-width":464,"medium-height":232,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/ToolProperties_ExecutionTab_EmbeddedScript_DownloadAtt.png","medium_large-width":768,"medium_large-height":384,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/ToolProperties_ExecutionTab_EmbeddedScript_DownloadAtt.png","large-width":1001,"large-height":501,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/ToolProperties_ExecutionTab_EmbeddedScript_DownloadAtt.png","1536x1536-width":1001,"1536x1536-height":501,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/ToolProperties_ExecutionTab_EmbeddedScript_DownloadAtt.png","2048x2048-width":1001,"2048x2048-height":501,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/ToolProperties_ExecutionTab_EmbeddedScript_DownloadAtt-826x413.png","card_image-width":826,"card_image-height":413,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/ToolProperties_ExecutionTab_EmbeddedScript_DownloadAtt.png","wide_image-width":1001,"wide_image-height":501}},"image_position":"center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<h2>Script tool behavior<\/h2>\n<p>Every new script tool contains a <a href=\"https:\/\/pro.arcgis.com\/en\/pro-app\/latest\/arcpy\/geoprocessing_and_python\/understanding-validation-in-script-tools.htm\">standard validation script.<\/a> Update this script <a href=\"https:\/\/pro.arcgis.com\/en\/pro-app\/latest\/arcpy\/geoprocessing_and_python\/customizing-script-tool-behavior.htm\">with Python code<\/a> to <a href=\"https:\/\/pro.arcgis.com\/en\/pro-app\/latest\/arcpy\/geoprocessing_and_python\/customizing-script-tool-behavior.htm\">control the behavior<\/a> of the tool. I like to refer to this script as making your tool a smart tool. Like error handling, one can think of this behavior as another option to mitigate errors before a user clicks the Run button. Therefore, the first parameter on the tool can return an error message for non-enabled feature classes or if it does not have any attachments to download. You can also control other behaviors of the tool, such as only showing the parameter to select a field if the check box has been selected.<\/p>\n"},{"acf_fc_layout":"image","image":{"ID":1756792,"id":1756792,"title":"Script_Validation_Example_w_errorMessage_DownloadAtt","filename":"Script_Validation_Example_w_errorMessage_DownloadAtt.png","filesize":43635,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Script_Validation_Example_w_errorMessage_DownloadAtt.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/data-management\/create-your-own-geoprocessing-tool-to-download-attachments\/script_validation_example_w_errormessage_downloadatt","alt":"Error message displayed on script tool from updated validation script.","author":"313872","description":"","caption":"","name":"script_validation_example_w_errormessage_downloadatt","status":"inherit","uploaded_to":1754342,"date":"2022-11-01 19:16:15","modified":"2022-11-01 19:17:07","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":842,"height":250,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Script_Validation_Example_w_errorMessage_DownloadAtt-213x200.png","thumbnail-width":213,"thumbnail-height":200,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Script_Validation_Example_w_errorMessage_DownloadAtt.png","medium-width":464,"medium-height":138,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Script_Validation_Example_w_errorMessage_DownloadAtt.png","medium_large-width":768,"medium_large-height":228,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Script_Validation_Example_w_errorMessage_DownloadAtt.png","large-width":842,"large-height":250,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Script_Validation_Example_w_errorMessage_DownloadAtt.png","1536x1536-width":842,"1536x1536-height":250,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Script_Validation_Example_w_errorMessage_DownloadAtt.png","2048x2048-width":842,"2048x2048-height":250,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Script_Validation_Example_w_errorMessage_DownloadAtt-826x245.png","card_image-width":826,"card_image-height":245,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Script_Validation_Example_w_errorMessage_DownloadAtt.png","wide_image-width":842,"wide_image-height":250}},"image_position":"center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"image","image":{"ID":1795242,"id":1795242,"title":"Final_Tool_w_Parameters_filled_DownloadAtt2_Final","filename":"Final_Tool_w_Parameters_filled_DownloadAtt2_Final.png","filesize":33688,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Final_Tool_w_Parameters_filled_DownloadAtt2_Final.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/data-management\/create-your-own-geoprocessing-tool-to-download-attachments\/final_tool_w_parameters_filled_downloadatt2_final","alt":"Final Tool with selected values for required fields and optional subfolder and rename fields.","author":"313872","description":"","caption":"","name":"final_tool_w_parameters_filled_downloadatt2_final","status":"inherit","uploaded_to":1754342,"date":"2022-12-13 23:30:10","modified":"2022-12-27 23:00:21","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":434,"height":795,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Final_Tool_w_Parameters_filled_DownloadAtt2_Final-213x200.png","thumbnail-width":213,"thumbnail-height":200,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Final_Tool_w_Parameters_filled_DownloadAtt2_Final.png","medium-width":142,"medium-height":261,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Final_Tool_w_Parameters_filled_DownloadAtt2_Final.png","medium_large-width":434,"medium_large-height":795,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Final_Tool_w_Parameters_filled_DownloadAtt2_Final.png","large-width":434,"large-height":795,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Final_Tool_w_Parameters_filled_DownloadAtt2_Final.png","1536x1536-width":434,"1536x1536-height":795,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Final_Tool_w_Parameters_filled_DownloadAtt2_Final.png","2048x2048-width":434,"2048x2048-height":795,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Final_Tool_w_Parameters_filled_DownloadAtt2_Final-254x465.png","card_image-width":254,"card_image-height":465,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/Final_Tool_w_Parameters_filled_DownloadAtt2_Final.png","wide_image-width":434,"wide_image-height":795}},"image_position":"right","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<h2>The finished product<\/h2>\n<p>With your script finished and imported into your script tool, you can run the tool on a feature class that has attachments you want to download to a specified folder. Optionally, you can organize the download attachments into subfolders based on field values in a field name of your choice. In my case, I downloaded airport picture attachments to subfolders for each airport name.<\/p>\n<p>In conclusion, I hope that this sample script and script tool provide some functionality that can be useful in your current or future workflows. I always learn something new from sample scripts and demonstrations that I can apply directly to a current project or later use. While this tool is all about downloading attachments from a feature class, you might find it to be more helpful for automating other workflows, better understanding of the Describe function or tool behavior. Either way, have fun and good luck creating your own data management geoprocessing tool to download attachments. Feel free to edit, update, improve or customize for your individual or organizational needs!<\/p>\n<p>You can download the following items:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.arcgis.com\/home\/item.html?id=863c2de58f2242e38c343160a76746fe\">Working copy of the sample tool (tool includes validation script)<\/a><\/li>\n<li><a href=\"https:\/\/www.arcgis.com\/home\/item.html?id=b28f1f47fb8941639868b6e53396d329\">Sample script for the tool<\/a><\/li>\n<li><a href=\"https:\/\/www.arcgis.com\/home\/item.html?id=530ae494d35947bfa27a3ac99ed2f7fb\">Sample data in a file geodatabase for testing<\/a><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n"},{"acf_fc_layout":"image","image":{"ID":1756852,"id":1756852,"title":"OutputFolder_w_SubFoldersByNameDownloadAtt","filename":"OutputFolder_w_SubFoldersByNameDownloadAtt.png","filesize":19834,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/OutputFolder_w_SubFoldersByNameDownloadAtt.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/data-management\/create-your-own-geoprocessing-tool-to-download-attachments\/outputfolder_w_subfoldersbynamedownloadatt","alt":"Downloaded attachments to output folder with subfolders by field name 'Name'","author":"313872","description":"","caption":"","name":"outputfolder_w_subfoldersbynamedownloadatt","status":"inherit","uploaded_to":1754342,"date":"2022-11-01 19:33:29","modified":"2022-11-01 19:34:21","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":720,"height":265,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/OutputFolder_w_SubFoldersByNameDownloadAtt-213x200.png","thumbnail-width":213,"thumbnail-height":200,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/OutputFolder_w_SubFoldersByNameDownloadAtt.png","medium-width":464,"medium-height":171,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/OutputFolder_w_SubFoldersByNameDownloadAtt.png","medium_large-width":720,"medium_large-height":265,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/OutputFolder_w_SubFoldersByNameDownloadAtt.png","large-width":720,"large-height":265,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/OutputFolder_w_SubFoldersByNameDownloadAtt.png","1536x1536-width":720,"1536x1536-height":265,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/OutputFolder_w_SubFoldersByNameDownloadAtt.png","2048x2048-width":720,"2048x2048-height":265,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/OutputFolder_w_SubFoldersByNameDownloadAtt.png","card_image-width":720,"card_image-height":265,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/OutputFolder_w_SubFoldersByNameDownloadAtt.png","wide_image-width":720,"wide_image-height":265}},"image_position":"center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<h2>Check out the video of the tool in action!<\/h2>\n<p>Learn how to use the features of the Download Attachments Sample tool to export feature class attachments to a designated folder with the option to rename the files.<\/p>\n"},{"acf_fc_layout":"kaltura","video_id":"1_bgfy692l","time":false,"start":0,"stop":""},{"acf_fc_layout":"sidebar","content":"<p>Note: The intent of this sample script and tool is to show one of many ways users can automate data management in a geodatabase. This sample does make a few assumptions, and individual circumstances may require users to change the code to meet specific needs. For instance, a feature class can participate in one or more relationship classes, and this sample does not check for multiple relationship classes. It does allow users to select a feature and it will download just the attachments from one or more selected features, but it does not verify if each feature has attachments to export. It also does not support date fields, as date types present issues for renaming folders and files and date conversion to text was beyond the scope of this sample. The script and tool should work for most users as is, but unforeseen errors and issues may occur. Please feel free to alter, update, and improve the script and tool to meet individual and organizational needs.<\/p>\n","image_reference":false,"layout":"standard","image_reference_figure":"","snippet":"","spotlight_name":"","section_title":"","position":"Center","spotlight_image":false},{"acf_fc_layout":"content","content":"<h3>Licensing Information:<\/h3>\n<p>Basic: Yes\u00a0 \u00a0 \u00a0Standard: Yes\u00a0 \u00a0 \u00a0Advanced: Yes<\/p>\n<h3>More Information:<\/h3>\n<p>Additionally, check out these other helpful resources when working with attachments, geodata, Python, and custom script tools:<\/p>\n<p><a href=\"https:\/\/www.esri.com\/training\/catalog\/57630436851d31e02a43f13c\/python-for-everyone\/\">Python for Everyone<\/a><\/p>\n<p><a href=\"https:\/\/www.esri.com\/training\/catalog\/5b0431e067b46f2fe61b082f\/creating-python-scripts-for-arcgis\/\">Creating Python Scripts for ArcGIS<\/a><\/p>\n<p><a href=\"https:\/\/www.youtube.com\/watch?v=r8CenylJ7c0\">Building Geoprocessing Tools with Python: Beyond the Basics<\/a><\/p>\n<p><a href=\"https:\/\/www.esri.com\/training\/catalog\/59c407ad3049c71bb91d784f\/managing-geospatial-data-in-arcgis\/\">Managing Geospatial Data in ArcGIS<\/a><\/p>\n<p><a href=\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-online\/mapping\/introducing-attachment-viewer\/\">Introducing Attachment Viewer!<\/a><\/p>\n<p><a href=\"https:\/\/storymaps.arcgis.com\/stories\/d2040c508a5f4602b0e8d6cc24cd6297\">Indexing and mapping the Mt. Zion Baptist Cemetery<\/a><\/p>\n<p><a href=\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-online\/mapping\/use-attachment-viewer\/\">Browse feature layer attachments using Attachment Viewer<\/a><\/p>\n"}],"related_articles":"","card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/11\/cardBanner_mjDesktop_DownloadAtt.png","wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2023\/01\/cardBanner_mjDesktop_DownloadAtt_New_Update.png","show_article_image":false},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.9 (Yoast SEO v25.9) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Create your own geoprocessing tool to download attachments<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/data-management\/create-your-own-geoprocessing-tool-to-download-attachments\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Create your own geoprocessing tool to download attachments\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/data-management\/create-your-own-geoprocessing-tool-to-download-attachments\" \/>\n<meta property=\"og:site_name\" content=\"ArcGIS Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/esrigis\/\" \/>\n<meta property=\"article:modified_time\" content=\"2025-05-14T14:41:29+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@ESRI\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"17 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":[\"Article\",\"BlogPosting\"],\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/data-management\/create-your-own-geoprocessing-tool-to-download-attachments#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/data-management\/create-your-own-geoprocessing-tool-to-download-attachments\"},\"author\":{\"name\":\"Mike Jensen\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/5b3542abdb02f708dfde873f92ccc7af\"},\"headline\":\"Create your own geoprocessing tool to download attachments\",\"datePublished\":\"2023-01-13T21:00:01+00:00\",\"dateModified\":\"2025-05-14T14:41:29+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/data-management\/create-your-own-geoprocessing-tool-to-download-attachments\"},\"wordCount\":8,\"publisher\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#organization\"},\"keywords\":[\"attachments\",\"python\",\"python scripts\",\"Script tools\"],\"articleSection\":[\"Data Management\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/data-management\/create-your-own-geoprocessing-tool-to-download-attachments\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/data-management\/create-your-own-geoprocessing-tool-to-download-attachments\",\"name\":\"Create your own geoprocessing tool to download attachments\",\"isPartOf\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#website\"},\"datePublished\":\"2023-01-13T21:00:01+00:00\",\"dateModified\":\"2025-05-14T14:41:29+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/data-management\/create-your-own-geoprocessing-tool-to-download-attachments#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/data-management\/create-your-own-geoprocessing-tool-to-download-attachments\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/data-management\/create-your-own-geoprocessing-tool-to-download-attachments#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.esri.com\/arcgis-blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Create your own geoprocessing tool to download attachments\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#website\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/\",\"name\":\"ArcGIS Blog\",\"description\":\"Get insider info from Esri product teams\",\"publisher\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.esri.com\/arcgis-blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#organization\",\"name\":\"Esri\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2018\/04\/Esri.png\",\"contentUrl\":\"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2018\/04\/Esri.png\",\"width\":400,\"height\":400,\"caption\":\"Esri\"},\"image\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/esrigis\/\",\"https:\/\/x.com\/ESRI\",\"https:\/\/www.linkedin.com\/company\/5311\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/5b3542abdb02f708dfde873f92ccc7af\",\"name\":\"Mike Jensen\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/07\/Mike_Green_Santa_Nov_2016-204x200.jpg\",\"contentUrl\":\"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/07\/Mike_Green_Santa_Nov_2016-204x200.jpg\",\"caption\":\"Mike Jensen\"},\"description\":\"Mike loves to enhance the customer experience when working with Esri software, and has many opportunities to continue this passion as a product engineer on the Geodatabase Team. Outside of his GIS profession, he loves to tinker with tech gadgets, beat on the drums, bake pies and brownies, tell and snicker at dad jokes, and enjoy quiet time in the country with family and friends.\",\"jobTitle\":\"Product Engineer - Geodatabase Team\",\"worksFor\":\"Esri\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/author\/mike-jensen\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Create your own geoprocessing tool to download attachments","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/data-management\/create-your-own-geoprocessing-tool-to-download-attachments","og_locale":"en_US","og_type":"article","og_title":"Create your own geoprocessing tool to download attachments","og_url":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/data-management\/create-your-own-geoprocessing-tool-to-download-attachments","og_site_name":"ArcGIS Blog","article_publisher":"https:\/\/www.facebook.com\/esrigis\/","article_modified_time":"2025-05-14T14:41:29+00:00","twitter_card":"summary_large_image","twitter_site":"@ESRI","twitter_misc":{"Est. reading time":"17 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["Article","BlogPosting"],"@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/data-management\/create-your-own-geoprocessing-tool-to-download-attachments#article","isPartOf":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/data-management\/create-your-own-geoprocessing-tool-to-download-attachments"},"author":{"name":"Mike Jensen","@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/5b3542abdb02f708dfde873f92ccc7af"},"headline":"Create your own geoprocessing tool to download attachments","datePublished":"2023-01-13T21:00:01+00:00","dateModified":"2025-05-14T14:41:29+00:00","mainEntityOfPage":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/data-management\/create-your-own-geoprocessing-tool-to-download-attachments"},"wordCount":8,"publisher":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/#organization"},"keywords":["attachments","python","python scripts","Script tools"],"articleSection":["Data Management"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/data-management\/create-your-own-geoprocessing-tool-to-download-attachments","url":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/data-management\/create-your-own-geoprocessing-tool-to-download-attachments","name":"Create your own geoprocessing tool to download attachments","isPartOf":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/#website"},"datePublished":"2023-01-13T21:00:01+00:00","dateModified":"2025-05-14T14:41:29+00:00","breadcrumb":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/data-management\/create-your-own-geoprocessing-tool-to-download-attachments#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/data-management\/create-your-own-geoprocessing-tool-to-download-attachments"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/data-management\/create-your-own-geoprocessing-tool-to-download-attachments#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.esri.com\/arcgis-blog\/"},{"@type":"ListItem","position":2,"name":"Create your own geoprocessing tool to download attachments"}]},{"@type":"WebSite","@id":"https:\/\/www.esri.com\/arcgis-blog\/#website","url":"https:\/\/www.esri.com\/arcgis-blog\/","name":"ArcGIS Blog","description":"Get insider info from Esri product teams","publisher":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.esri.com\/arcgis-blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.esri.com\/arcgis-blog\/#organization","name":"Esri","url":"https:\/\/www.esri.com\/arcgis-blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2018\/04\/Esri.png","contentUrl":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2018\/04\/Esri.png","width":400,"height":400,"caption":"Esri"},"image":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/esrigis\/","https:\/\/x.com\/ESRI","https:\/\/www.linkedin.com\/company\/5311\/"]},{"@type":"Person","@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/5b3542abdb02f708dfde873f92ccc7af","name":"Mike Jensen","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/image\/","url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/07\/Mike_Green_Santa_Nov_2016-204x200.jpg","contentUrl":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2022\/07\/Mike_Green_Santa_Nov_2016-204x200.jpg","caption":"Mike Jensen"},"description":"Mike loves to enhance the customer experience when working with Esri software, and has many opportunities to continue this passion as a product engineer on the Geodatabase Team. Outside of his GIS profession, he loves to tinker with tech gadgets, beat on the drums, bake pies and brownies, tell and snicker at dad jokes, and enjoy quiet time in the country with family and friends.","jobTitle":"Product Engineer - Geodatabase Team","worksFor":"Esri","url":"https:\/\/www.esri.com\/arcgis-blog\/author\/mike-jensen"}]}},"text_date":"January 13, 2023","author_name":"Mike Jensen","author_page":"https:\/\/www.esri.com\/arcgis-blog\/author\/mike-jensen","custom_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2023\/01\/cardBanner_mjDesktop_DownloadAtt_New_Update.png","primary_product":"ArcGIS Pro","tag_data":[{"term_id":762502,"name":"attachments","slug":"attachments","term_group":0,"term_taxonomy_id":762502,"taxonomy":"post_tag","description":"","parent":0,"count":10,"filter":"raw"},{"term_id":24341,"name":"python","slug":"python","term_group":0,"term_taxonomy_id":24341,"taxonomy":"post_tag","description":"","parent":0,"count":171,"filter":"raw"},{"term_id":649691,"name":"python scripts","slug":"python-scripts","term_group":0,"term_taxonomy_id":649691,"taxonomy":"post_tag","description":"","parent":0,"count":6,"filter":"raw"},{"term_id":30981,"name":"Script tools","slug":"script-tools","term_group":0,"term_taxonomy_id":30981,"taxonomy":"post_tag","description":"","parent":0,"count":5,"filter":"raw"}],"category_data":[{"term_id":23851,"name":"Data Management","slug":"data-management","term_group":0,"term_taxonomy_id":23851,"taxonomy":"category","description":"","parent":0,"count":920,"filter":"raw"}],"product_data":[{"term_id":36561,"name":"ArcGIS Pro","slug":"arcgis-pro","term_group":0,"term_taxonomy_id":36561,"taxonomy":"product","description":"","parent":0,"count":2037,"filter":"raw"}],"primary_product_link":"https:\/\/www.esri.com\/arcgis-blog\/?s=#&products=arcgis-pro","_links":{"self":[{"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/blog\/1754342","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/blog"}],"about":[{"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/types\/blog"}],"author":[{"embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/users\/313872"}],"replies":[{"embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/comments?post=1754342"}],"version-history":[{"count":0,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/blog\/1754342\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/media?parent=1754342"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/categories?post=1754342"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/tags?post=1754342"},{"taxonomy":"industry","embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/industry?post=1754342"},{"taxonomy":"product","embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/product?post=1754342"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}