<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to script AGOL Metadata Editor 'save' function to enable file geodatabase download option in AGOL Open Data? in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/how-to-script-agol-metadata-editor-save-function/m-p/1031732#M38716</link>
    <description>&lt;P&gt;Hello -&lt;/P&gt;&lt;P&gt;I use this Python script to upload XML, ArcGIS formatted metadata to items in AGOL. The items are registered feature layers of ArcGIS Server map services.&lt;/P&gt;&lt;P&gt;The XMLs have been edited to enable a zipped file geodatabase download in our AGOL Open Data Site. The geodatabase download only becomes available in Open Data after I run the script and then manually open the AGOL metadata editor for that item and click the 'save' button.&lt;/P&gt;&lt;P&gt;I haven't found a way to script the Metadata Editor 'save' function with the ArcGIS API for Python. Anybody know how?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Stacey&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import os, csv
from arcgis.gis import GIS

#Set path, user ID, and password to AGOL account
userid = "username"
gis = GIS("AGOL URL", userid, "password")

#Set variables
userfolder = "folder name"
csvdata = "path to csv"
xml_path = "path to xml folder"

#Get a list of items in AGOL folder
user = gis.users.get(userid)
itemslist = user.items(folder=userfolder, max_items=500)

#Iterate through AGOL items and CSV records
for item in itemslist:
    csv_reader = csv.DictReader(open(csvdata))
    for row in csv_reader:
        namefield = row['AGOLTitle']
        xmlfield = row['XMLName']
        add_xml = os.path.join(xml_path, xmlfield)
        #Update AGOL items that match CSV records
        if item.title == namefield:
            item.update(metadata=add_xml)
        else:
            continue
del item&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 01 Mar 2021 23:28:05 GMT</pubDate>
    <dc:creator>StaceyPlumley</dc:creator>
    <dc:date>2021-03-01T23:28:05Z</dc:date>
    <item>
      <title>How to script AGOL Metadata Editor 'save' function to enable file geodatabase download option in AGOL Open Data?</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/how-to-script-agol-metadata-editor-save-function/m-p/1031732#M38716</link>
      <description>&lt;P&gt;Hello -&lt;/P&gt;&lt;P&gt;I use this Python script to upload XML, ArcGIS formatted metadata to items in AGOL. The items are registered feature layers of ArcGIS Server map services.&lt;/P&gt;&lt;P&gt;The XMLs have been edited to enable a zipped file geodatabase download in our AGOL Open Data Site. The geodatabase download only becomes available in Open Data after I run the script and then manually open the AGOL metadata editor for that item and click the 'save' button.&lt;/P&gt;&lt;P&gt;I haven't found a way to script the Metadata Editor 'save' function with the ArcGIS API for Python. Anybody know how?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Stacey&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import os, csv
from arcgis.gis import GIS

#Set path, user ID, and password to AGOL account
userid = "username"
gis = GIS("AGOL URL", userid, "password")

#Set variables
userfolder = "folder name"
csvdata = "path to csv"
xml_path = "path to xml folder"

#Get a list of items in AGOL folder
user = gis.users.get(userid)
itemslist = user.items(folder=userfolder, max_items=500)

#Iterate through AGOL items and CSV records
for item in itemslist:
    csv_reader = csv.DictReader(open(csvdata))
    for row in csv_reader:
        namefield = row['AGOLTitle']
        xmlfield = row['XMLName']
        add_xml = os.path.join(xml_path, xmlfield)
        #Update AGOL items that match CSV records
        if item.title == namefield:
            item.update(metadata=add_xml)
        else:
            continue
del item&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Mar 2021 23:28:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/how-to-script-agol-metadata-editor-save-function/m-p/1031732#M38716</guid>
      <dc:creator>StaceyPlumley</dc:creator>
      <dc:date>2021-03-01T23:28:05Z</dc:date>
    </item>
  </channel>
</rss>

