Select to view content in your preferred language

Question: Clone item with desired name/title

939
3
05-17-2022 02:14 PM
RossMa
by
Emerging Contributor

Hi,

Is there a way to clone item (hosted feature layer) with a user defined name or title for new hosted feature layer? 

I did look the python api  clone module , it dosen't list any naming related argument

clone_items(itemsfolder=Noneitem_extent=Noneuse_org_basemap=Falsecopy_data=Truecopy_global_ids=Falsesearch_existing_items=Trueitem_mapping=Nonegroup_mapping=Noneowner=Nonepreserve_item_id=False)

I was wondering if the name or title can be defined in the clone_item funtion, other than end up with 

RossMa_0-1652822026388.png

Thank you very much.

3 Replies
Clubdebambos
MVP Regular Contributor

Hi @RossMa 

You can rename after the clone has taken place 

from arcgis import GIS

agol = GIS("home")

## you can get the item_id after the clone,
## either programmatically and add to the clone script
## or manually and use this as a separate scripT
fs = agol.content.get("new_item_id")

properties_dict = {
    "title" : "Insert_New_Title"
}

fs.update(item_properties=properties_dict)

 

 

~ learn.finaldraftmapping.com
AdamGaudet
Regular Contributor

I would love this to be an argument in the function. I'm creating occasional backups of items and want the suffix "BACKUP_YYYYMMDD" in the cloned name to clearly delineate backups from the original source data. Having to locate the id of the newly created cloned item is a bit bothersome and just adds unnecessary lines of code. 

chris_del101
Regular Contributor

I would also like this feature. Being able to rename it makes it easier to identify after the fact. Having tons of artifacts with the same name is very time consuming to sift through.

0 Kudos