Select to view content in your preferred language

clone_items() doesn't work with ArcGIS Enterprise Portal 11.1?

80
1
2 weeks ago
BBowers_napacounty
New Contributor II

I just upgraded to ArcGIS Portal 11.1, and now clone_items() doesn't work. Here is an example:

item_id = 'f977c5ea26de465bb21c796dc7e5d95a'
item = source_gis.content.get(item_id)
cloned_items = target_gis.content.clone_items(items=[item], preserve_item_id=True)

And here is the error traceback:

---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_17668\1636443366.py in <cell line: 1>()
----> 1 cloned_items = target_gis.content.clone_items(items=[item], preserve_item_id=True)
2 cloned_items

C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\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, preserve_item_id)
7887 preserve_item_id = False
7888
-> 7889 deep_cloner = clone._DeepCloner(
7890 self._gis,
7891 items,

C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\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
--> 108 self._create_graph()
109 self._cloned_items = []
110

C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\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
--> 120 self._get_item_definitions(item)
121
122 # Test if the user has the correct privileges to create the items requested

C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\_impl\common\_clone.py in _get_item_definitions(self, item)
987 # All other types we no longer need to recursively look for related items
988 else:
--> 989 item_definition = self._get_item_definition(item)
990 self._graph[item.id] = item_definition
991

C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\_impl\common\_clone.py in _get_item_definition(self, item)
1611 )
1612
-> 1613 return _WebExperience(
1614 self.target,
1615 self._clone_mapping,

C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\_impl\common\_itemdef\_expbuilder.py in __init__(self, target, clone_mapping, info, data, sharing, thumbnail, portal_item, folder, item_extent, search_existing, owner, **kwargs)
25 **kwargs,
26 😞
---> 27 super().__init__(target, clone_mapping, search_existing)
28 self.info = info
29 self._preserve_item_id = kwargs.pop("preserve_item_id", False)

C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\_impl\common\_clone.py in __init__(self, target, clone_mapping, info, data, sharing, thumbnail, portal_item, folder, item_extent, search_existing, owner, **kwargs)
1987 self.item_extent = item_extent
1988 self.created_items = []
-> 1989 self.metadata_xml = portal_item.metadata
1990
1991 @property

AttributeError: 'NoneType' object has no attribute 'metadata'

Any ideas?

0 Kudos
1 Reply
David_McRitchie
Esri Contributor

Hey BBowers,

Can I just double check if this item is for an Experience Builder application?

Based on the error message it seems like the notebook is not successfully retrieving the item for cloning. Based on this I have a suspicion that this might be to do with the iteminfo.xml that is part of the application that would host the metadata. It might be worth finding this file and putting it into an XML validation tool to see if this is the case. By default you can find this file under C:\arcgis\arcgisportal\content\items.

I would also check if other Experience or item types are successfully cloning such as Hosted Feature Layers.

Hope that helps,

David

Esri UK -Technical Support Analyst
0 Kudos