<?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 Re: Clone or copy webmap item in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/clone-or-copy-webmap-item/m-p/1112032#M6764</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I believe Clone_items is only for cloning items between different portals (eg. from staging to production portal). That is what I am using it for!&lt;/P&gt;&lt;P&gt;Maybe look into item.copy.item? I have never tried that though.&lt;/P&gt;</description>
    <pubDate>Thu, 28 Oct 2021 10:46:48 GMT</pubDate>
    <dc:creator>CarstenB_orsted</dc:creator>
    <dc:date>2021-10-28T10:46:48Z</dc:date>
    <item>
      <title>Clone or copy webmap item</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/clone-or-copy-webmap-item/m-p/1112024#M6762</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;can someone tell me how I can copy or clone a "Web Map" item from my user root folder into another folder?&lt;BR /&gt;&lt;BR /&gt;I have ArcGIS Pro 2.8.3 installed and arcgis API version 1.8.5 (latest I can get).&lt;BR /&gt;&lt;BR /&gt;I tried&lt;/P&gt;&lt;LI-CODE lang="python"&gt;clone_results = gis.content.clone_items(items=[map_template], folder="test")&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;and yes, map_template is really the web map item in my root folder and "test" exists.&lt;BR /&gt;&lt;BR /&gt;I get an error:&lt;/P&gt;&lt;P&gt;Exception Traceback (most recent call last)&lt;BR /&gt;~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\_impl\common\_clone.py in clone(self)&lt;BR /&gt;2423 # Add the new item&lt;BR /&gt;-&amp;gt; 2424 new_item = self._add_new_item(item_properties)&lt;BR /&gt;2425&lt;/P&gt;&lt;P&gt;~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\_impl\common\_clone.py in _add_new_item(self, item_properties, data)&lt;BR /&gt;1208&lt;BR /&gt;-&amp;gt; 1209 new_item = self.target.content.add(item_properties=item_properties, data=data, thumbnail=thumbnail, folder=self.folder, owner=self.owner)&lt;BR /&gt;1210 self.created_items.append(new_item)&lt;/P&gt;&lt;P&gt;~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\gis\__init__.py in add(self, item_properties, data, thumbnail, metadata, owner, folder, item_id)&lt;BR /&gt;4264 thumbnail, metadata,&lt;BR /&gt;-&amp;gt; 4265 owner_name, folder)&lt;BR /&gt;4266&lt;/P&gt;&lt;P&gt;~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\gis\_impl\_portalpy.py in add_item(self, item_properties, data, thumbnail, metadata, owner, folder)&lt;BR /&gt;354 path += '/addItem'&lt;BR /&gt;--&amp;gt; 355 resp = self.con.post(path, postdata, files)&lt;BR /&gt;356 if resp and resp.get('success'):&lt;/P&gt;&lt;P&gt;~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\gis\_impl\_con\_connection.py in post(self, path, params, files, **kwargs)&lt;BR /&gt;719 try_json=try_json,&lt;BR /&gt;--&amp;gt; 720 force_bytes=kwargs.pop('force_bytes', False))&lt;BR /&gt;721 #----------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\gis\_impl\_con\_connection.py in _handle_response(self, resp, file_name, out_path, try_json, force_bytes)&lt;BR /&gt;513 errorcode = data['error']['code'] if 'code' in data['error'] else 0&lt;BR /&gt;--&amp;gt; 514 self._handle_json_error(data['error'], errorcode)&lt;BR /&gt;515 return data&lt;/P&gt;&lt;P&gt;~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\gis\_impl\_con\_connection.py in _handle_json_error(self, error, errorcode)&lt;BR /&gt;535 errormessage = errormessage + "\n(Error Code: " + str(errorcode) +")"&lt;BR /&gt;--&amp;gt; 536 raise Exception(errormessage)&lt;BR /&gt;537 #----------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;Exception: Unable to generate dependencies&lt;BR /&gt;Unable to generate dependencies&lt;BR /&gt;(Error Code: 500)&lt;/P&gt;&lt;P&gt;During handling of the above exception, another exception occurred:&lt;/P&gt;&lt;P&gt;_ItemCreateException Traceback (most recent call last)&lt;BR /&gt;&amp;lt;ipython-input-5-dd6b2e4b5b45&amp;gt; in &amp;lt;module&amp;gt;&lt;BR /&gt;100&lt;BR /&gt;101 # Copy template map to new item in project folder&lt;BR /&gt;--&amp;gt; 102 clone_results = gis.content.clone_items(items=[map_template], folder="test")&lt;BR /&gt;103&lt;BR /&gt;104 print(clone_results)&lt;/P&gt;&lt;P&gt;~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\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)&lt;BR /&gt;5515 owner_name = owner.username&lt;BR /&gt;5516 deep_cloner = clone._DeepCloner(self._gis, items, folder, wgs84_extent, service_extent, use_org_basemap, copy_data, copy_global_ids, search_existing_items, item_mapping, group_mapping, owner_name)&lt;BR /&gt;-&amp;gt; 5517 return deep_cloner.clone()&lt;BR /&gt;5518&lt;BR /&gt;5519 def bulk_update(self, itemids, properties):&lt;/P&gt;&lt;P&gt;~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\_impl\common\_clone.py in clone(self)&lt;BR /&gt;811 else:&lt;BR /&gt;812 with concurrent.futures.ThreadPoolExecutor(max_workers=20) as executor:&lt;BR /&gt;--&amp;gt; 813 results = executor.submit(self._clone, executor).result()&lt;BR /&gt;814 return results&lt;BR /&gt;815&lt;/P&gt;&lt;P&gt;~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\concurrent\futures\_base.py in result(self, timeout)&lt;BR /&gt;433 raise CancelledError()&lt;BR /&gt;434 elif self._state == FINISHED:&lt;BR /&gt;--&amp;gt; 435 return self.__get_result()&lt;BR /&gt;436 else:&lt;BR /&gt;437 raise TimeoutError()&lt;/P&gt;&lt;P&gt;~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\concurrent\futures\_base.py in __get_result(self)&lt;BR /&gt;382 def __get_result(self):&lt;BR /&gt;383 if self._exception:&lt;BR /&gt;--&amp;gt; 384 raise self._exception&lt;BR /&gt;385 else:&lt;BR /&gt;386 return self._result&lt;/P&gt;&lt;P&gt;~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\concurrent\futures\thread.py in run(self)&lt;BR /&gt;55&lt;BR /&gt;56 try:&lt;BR /&gt;---&amp;gt; 57 result = self.fn(*self.args, **self.kwargs)&lt;BR /&gt;58 except BaseException as exc:&lt;BR /&gt;59 self.future.set_exception(exc)&lt;/P&gt;&lt;P&gt;~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\_impl\common\_clone.py in _clone(self, excecutor)&lt;BR /&gt;798 if item:&lt;BR /&gt;799 item.delete()&lt;BR /&gt;--&amp;gt; 800 raise ex&lt;BR /&gt;801&lt;BR /&gt;802 level += 1&lt;/P&gt;&lt;P&gt;~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\concurrent\futures\thread.py in run(self)&lt;BR /&gt;55&lt;BR /&gt;56 try:&lt;BR /&gt;---&amp;gt; 57 result = self.fn(*self.args, **self.kwargs)&lt;BR /&gt;58 except BaseException as exc:&lt;BR /&gt;59 self.future.set_exception(exc)&lt;/P&gt;&lt;P&gt;~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\_impl\common\_clone.py in clone(self)&lt;BR /&gt;2429 return new_item&lt;BR /&gt;2430 except Exception as ex:&lt;BR /&gt;-&amp;gt; 2431 raise _ItemCreateException("Failed to create {0} {1}: {2}".format(original_item['type'], original_item['title'], str(ex)), new_item)&lt;BR /&gt;2432&lt;BR /&gt;2433&lt;/P&gt;&lt;P&gt;_ItemCreateException: ('Failed to create Web Map vorlage-karte: Unable to generate dependencies\nUnable to generate dependencies\n(Error Code: 500)', None)&lt;BR /&gt;&lt;BR /&gt;I already reinstalled my whole ArcGIS Pro and conda/python environment, error remains.&lt;BR /&gt;&lt;BR /&gt;Any ideas?&lt;/P&gt;</description>
      <pubDate>Thu, 28 Oct 2021 09:44:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/clone-or-copy-webmap-item/m-p/1112024#M6762</guid>
      <dc:creator>RichardReinicke</dc:creator>
      <dc:date>2021-10-28T09:44:36Z</dc:date>
    </item>
    <item>
      <title>Re: Clone or copy webmap item</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/clone-or-copy-webmap-item/m-p/1112032#M6764</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I believe Clone_items is only for cloning items between different portals (eg. from staging to production portal). That is what I am using it for!&lt;/P&gt;&lt;P&gt;Maybe look into item.copy.item? I have never tried that though.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Oct 2021 10:46:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/clone-or-copy-webmap-item/m-p/1112032#M6764</guid>
      <dc:creator>CarstenB_orsted</dc:creator>
      <dc:date>2021-10-28T10:46:48Z</dc:date>
    </item>
    <item>
      <title>Re: Clone or copy webmap item</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/clone-or-copy-webmap-item/m-p/1112034#M6765</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/475927"&gt;@CarstenB_orsted&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;I believe, you're right in this points. I came to the same conclusion when browsing online materials:&lt;BR /&gt;&lt;BR /&gt;I also tested following way:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;map_json = json.dumps(map_template.get_data(try_json=True))
project_map = gis.content.add({"title": "ABC", "type": "Web Map", "snippet": "ABCD", "tags": "XYZ", "text": map_json}, folder="test")&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;Exact same result here!&lt;BR /&gt;&lt;BR /&gt;I'll also try your version as wll now.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Oct 2021 10:59:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/clone-or-copy-webmap-item/m-p/1112034#M6765</guid>
      <dc:creator>RichardReinicke</dc:creator>
      <dc:date>2021-10-28T10:59:01Z</dc:date>
    </item>
    <item>
      <title>Re: Clone or copy webmap item</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/clone-or-copy-webmap-item/m-p/1112035#M6766</link>
      <description>&lt;P&gt;Function item.copy_item() is not available in 1.8.5 and I dont know how I can get the latest 1.9.1 version because I'm using ArcGIS Pro environment clone and latest Pro version 2.8.3 only supports 1.8.5.&lt;BR /&gt;&lt;BR /&gt;item.copy() doesn't seem to be appropriate for what I'm trying to achieve.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Oct 2021 11:09:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/clone-or-copy-webmap-item/m-p/1112035#M6766</guid>
      <dc:creator>RichardReinicke</dc:creator>
      <dc:date>2021-10-28T11:09:33Z</dc:date>
    </item>
    <item>
      <title>Re: Clone or copy webmap item</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/clone-or-copy-webmap-item/m-p/1112038#M6767</link>
      <description>&lt;P&gt;3. Option now&lt;BR /&gt;clone_results = WebMap(map_template).save({"title": "ABC", "snippet": "XYZ", "tags": "abc"}, folder="test")&lt;BR /&gt;&lt;BR /&gt;Exact same result... okay it must be something else related to our portal...&lt;BR /&gt;I'll investigate this.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Oct 2021 11:17:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/clone-or-copy-webmap-item/m-p/1112038#M6767</guid>
      <dc:creator>RichardReinicke</dc:creator>
      <dc:date>2021-10-28T11:17:50Z</dc:date>
    </item>
    <item>
      <title>Re: Clone or copy webmap item</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/clone-or-copy-webmap-item/m-p/1112040#M6768</link>
      <description>&lt;P&gt;Okay all 3 approaches have the same result BUT I forgot to mention that in all three cases the web map copy get's created in the other folder only in my jupyter notebook I get the strange python error.&lt;/P&gt;&lt;P&gt;Portal logs looking okay. Item created successfully.&lt;/P&gt;&lt;P&gt;So it seems to be a communication problem between arcgis python API and the portal. Also the error is raised in&amp;nbsp;_connection.py!&lt;/P&gt;</description>
      <pubDate>Thu, 28 Oct 2021 11:26:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/clone-or-copy-webmap-item/m-p/1112040#M6768</guid>
      <dc:creator>RichardReinicke</dc:creator>
      <dc:date>2021-10-28T11:26:09Z</dc:date>
    </item>
    <item>
      <title>Re: Clone or copy webmap item</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/clone-or-copy-webmap-item/m-p/1112086#M6769</link>
      <description>&lt;P&gt;Okay, I found the mistake. I had an invalid layer in my template map. The invalid layer was the result of trying to create a new group layer programmatically.&lt;/P&gt;&lt;P&gt;Without the invalid layer there are several ways to achieve the copy webmap task. Here is one that I'm using now and which is working for me:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# This is my base webmap (template)
map_template = gis.content.get('some_item_id')

# Copy template to new web map item into subfolder
project_map = WebMap(map_template).save({
    "title": "project map",
    "snippet": "some description",
    "tags": "maps"}, folder="project_folder")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Nov 2021 08:32:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/clone-or-copy-webmap-item/m-p/1112086#M6769</guid>
      <dc:creator>RichardReinicke</dc:creator>
      <dc:date>2021-11-02T08:32:02Z</dc:date>
    </item>
  </channel>
</rss>

