<?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 Betreff: Error when using clone_items() in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/error-when-using-clone-items/m-p/1172840#M7384</link>
    <description>&lt;P&gt;Sadly the problem could not be fixed, so I needed to clone the items one after the other.&lt;BR /&gt;First searching for the ID in AGO, then running the script with get and clone function.&lt;/P&gt;&lt;P&gt;Without much knowledge about Python I came out with this (like the clone_items function is described):&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS

gis1 = GIS("https://arcgis.com", "", "")
gis2 = GIS("https://arcgis.com", "", "")

a = gis1.content.get("ID")
b = gis1.content.get("ID")
c = gis1.content.get("ID")
d = gis1.content.get("ID")

gis2.content.clone_items([a, b, c, d])&lt;/LI-CODE&gt;&lt;P&gt;This&amp;nbsp;definitely could be done better, but in the end it worked for me.&lt;/P&gt;&lt;P&gt;But there is&amp;nbsp;a function missing, that can list all the IDs of your content. This would have helped me a lot.&lt;/P&gt;</description>
    <pubDate>Wed, 11 May 2022 14:55:57 GMT</pubDate>
    <dc:creator>MartinHäckel</dc:creator>
    <dc:date>2022-05-11T14:55:57Z</dc:date>
    <item>
      <title>Error when using clone_items()</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/error-when-using-clone-items/m-p/1163838#M7309</link>
      <description>&lt;P&gt;Hello everyone!&lt;/P&gt;&lt;P&gt;We have moved our subcription of ArcGIS Online from US-Server to EU-Server. The bad is, that we have to get a new subcription and account for this.&amp;nbsp;As a result of this we have to clone all items from the old account to the new one.&lt;/P&gt;&lt;P&gt;I used this technical support article&amp;nbsp;&lt;A href="https://support.esri.com/en/technical-article/000022252" target="_blank"&gt;https://support.esri.com/en/technical-article/000022252&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Unfortunately I get an error!&lt;/P&gt;&lt;P&gt;My simple code is:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS

gis1 = GIS("https://arcgis.com", "", "")
gis2 = GIS("https://arcgis.com", "", "")

num_items = 250 
items = gis1.content.search(query='owner:', max_items=num_items)
items

gis2.content.clone_items(items)&lt;/LI-CODE&gt;&lt;P&gt;I used items and num_items, because only in this way, all items were listed, otherwise there were only 13 items showed.&lt;/P&gt;&lt;P&gt;This is the error I get:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/tmp/ipykernel_129/2581389438.py in &amp;lt;module&amp;gt;
      8 items
      9 
---&amp;gt; 10 gis2.content.clone_items(items)

/opt/conda/lib/python3.7/site-packages/arcgis/gis/__init__.py in clone_items(self, items, folder, item_extent, use_org_basemap, copy_data, copy_global_ids, search_existing_items, item_mapping, group_mapping, owner, preserve_item_id)
   6728             group_mapping,
   6729             owner_name,
-&amp;gt; 6730             preserve_item_id=preserve_item_id,
   6731         )
   6732         return deep_cloner.clone()

/opt/conda/lib/python3.7/site-packages/arcgis/_impl/common/_clone.py in __init__(self, target, items, folder, item_extent, service_extent, use_org_basemap, copy_data, copy_global_ids, search_existing_items, item_mapping, group_mapping, owner, preserve_item_id)
    106         self._temp_dir = tempfile.TemporaryDirectory()
    107         # parse the config and get values
--&amp;gt; 108         self._create_graph()
    109         self._cloned_items = []
    110 

/opt/conda/lib/python3.7/site-packages/arcgis/_impl/common/_clone.py in _create_graph(self)
    118             user = self.target.users.me
    119             # Get the definitions associated with the item
--&amp;gt; 120             self._get_item_definitions(item)
    121 
    122             # Test if the user has the correct privileges to create the items requested

/opt/conda/lib/python3.7/site-packages/arcgis/_impl/common/_clone.py in _get_item_definitions(self, item)
    326                 except RuntimeError:
    327                     raise
--&amp;gt; 328                 item_definition.add_child(self._get_item_definitions(webmap))
    329             for layer_id in layer_ids:
    330                 try:

/opt/conda/lib/python3.7/site-packages/arcgis/_impl/common/_clone.py in _get_item_definitions(self, item)
    243 
    244         item_definition = None
--&amp;gt; 245         source = item._gis
    246 
    247         # Check if the item definition has already been added to the collection of item definitions

AttributeError: 'NoneType' object has no attribute '_gis'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I am doing wrong here?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2022 12:28:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/error-when-using-clone-items/m-p/1163838#M7309</guid>
      <dc:creator>MartinHäckel</dc:creator>
      <dc:date>2022-04-13T12:28:33Z</dc:date>
    </item>
    <item>
      <title>Betreff: Error when using clone_items()</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/error-when-using-clone-items/m-p/1163870#M7310</link>
      <description>&lt;P&gt;This is also not working:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS

gis1 = GIS("https://arcgis.com", "", "")
gis2 = GIS("https://arcgis.com", "", "")

item = gis1.content.get("*")

gis2.content.clone_items([item])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;AttributeError&lt;/SPAN&gt;: 'NoneType' object has no attribute '_gis'&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Apr 2022 13:24:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/error-when-using-clone-items/m-p/1163870#M7310</guid>
      <dc:creator>MartinHäckel</dc:creator>
      <dc:date>2022-04-13T13:24:24Z</dc:date>
    </item>
    <item>
      <title>Betreff: Error when using clone_items()</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/error-when-using-clone-items/m-p/1172840#M7384</link>
      <description>&lt;P&gt;Sadly the problem could not be fixed, so I needed to clone the items one after the other.&lt;BR /&gt;First searching for the ID in AGO, then running the script with get and clone function.&lt;/P&gt;&lt;P&gt;Without much knowledge about Python I came out with this (like the clone_items function is described):&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS

gis1 = GIS("https://arcgis.com", "", "")
gis2 = GIS("https://arcgis.com", "", "")

a = gis1.content.get("ID")
b = gis1.content.get("ID")
c = gis1.content.get("ID")
d = gis1.content.get("ID")

gis2.content.clone_items([a, b, c, d])&lt;/LI-CODE&gt;&lt;P&gt;This&amp;nbsp;definitely could be done better, but in the end it worked for me.&lt;/P&gt;&lt;P&gt;But there is&amp;nbsp;a function missing, that can list all the IDs of your content. This would have helped me a lot.&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2022 14:55:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/error-when-using-clone-items/m-p/1172840#M7384</guid>
      <dc:creator>MartinHäckel</dc:creator>
      <dc:date>2022-05-11T14:55:57Z</dc:date>
    </item>
  </channel>
</rss>

