Select to view content in your preferred language

Cloning Content

59
1
yesterday
kapalczynski
Frequent Contributor

Looking at this example to move content from AGOL to my Portal.  

https://developers.arcgis.com/python/latest/guide/cloning-content/

Have a question... 

1.  If I clone a Dashboard using the above, do I need to define everything involved (Feature Layer, Web Map and Dashboard) or can I simply define the Dashboard and it will move all 3?

2. I am confused on the coding ... 

# Is this refering to my username and password?
# like this
# gis = GIS("https://xyzx/portal", "username", "password")
       
source = GIS(profile="your_online_admin_profile")

 

# I am really confused on the below "api_data_owner" and "cloning_guide"
# what is that refering too?

cloned_flyr = target.content.clone_items(items=[hosted_flyr],
                                         owner="api_data_owner",
                                         folder="cloning_guide")
0 Kudos
1 Reply
kapalczynski
Frequent Contributor

OK I got this far... 
My Hosted Feature, web map and web experience are cloned and show up on the correct portal and folder

BUT the web map is asking me to sign in so it looks like its cloned BUT NOT copied... I read some where about using item_mapping=webmap_item_mapping to map your web map but this is not working as its still trying to reference AGOL for the layers ... asking me to sign in to AGOL even though I am in Portal

The Experience is a whole other story... I open it and see this 

Cannot read properties of undefined (reading 'indexOf')

 

Can I use this approach to Copy a Feature Layer, Web Map and Experience and have them actually COPY and live in Portal and NOT reference AGOL

If not does ESRI have an other difficult ways to do this?

 

copy_listNew = []
itemidAll = ['d269421xxxxxxxxxxx545009', '419dc7xxxxxxxxxxxx61d72', '56500f55xxxxxxxx26f613fea']

for item in itemidAll:
    itemsSearch = GISsource.content.search(item)
    itemsSearch
    for item in itemsSearch:
        copy_list = []
        copy_list.append(item)
        print("Cloning " + item.title)
        copy_listNew.append(item.title)

        webmap_item_mapping = {'419dc796xxxxxxxxxxxx61d72': '8e3b33dxxxxxxxxxxx6b74eeedab5'}

        clone_results = GIStarget.content.clone_items(copy_list,              
            copy_data=True,
            item_mapping=webmap_item_mapping,
            search_existing_items=True,
            owner="SIG",
            folder="Test"
        )

usin 

0 Kudos