Select to view content in your preferred language

How to mass download portal content for user

633
2
10-17-2022 11:50 AM
Labels (2)
LizParrish_Geospatial
New Contributor

Using ArcGIS Enterprise 10.9.1 on Windows Server, have a Creator user who has not followed best practices and has conflated her content.  This was caught during a regular Administrative content/system audit and we are seeking a solution to move this out of the Portal.  The user indicates she needs to retain the data and PDFs locally.  I could not find documentation on how to download hosted data into a local FGDB and download PDFs into a local folder.  Preferably this could be done en masse.  

0 Kudos
2 Replies
Scott_Tansley
MVP Regular Contributor

Hey - you may want to look at this on the ArcGIS Marketplace:

https://www.esri.com/en-us/arcgis-marketplace/listing/products/8b0aa70f82574f7298537ab966ff45b8

BTW - I'm not affiliated with the company, it's just that some of my clients use this for similar purposes..

Scott Tansley
https://www.linkedin.com/in/scotttansley/
jcarlson
MVP Esteemed Contributor

What does that mean, "conflating her content"? I'm unfamiliar with the term in this context.

Anyway, downloading all content from a single user is easy enough, if you're familiar with the Python API.

https://developers.arcgis.com/python/api-reference/

Feature services get more complicated, but other items can simply be downloaded. It might look like this:

from arcgis.gis import GIS

gis = GIS('your portal url', 'username', 'password')
username = input('Username: ')
user_items = gis.content.search(f'owner:{username}', max_items=-1)

filepath = 'path you want to save items to'

print(f'{len(user_items} items found belonging to {username}.')

for i in user_items:
    if i.type == 'Feature Service':
        temp_export = i.export(i.title, 'File Geodatabase', tags='temp_export')
        temp_export.download(filepath, i.title)
        temp_export.delete()
    elif i.type == 'PDF':
        i.download(filepath, i.title)

 

- Josh Carlson
Kendall County GIS
0 Kudos