Is it possible to get a list of all arcgis online items with the python module?
This is the API reference https://esri.github.io/arcgis-python-api/apidoc/html/
What specifically is it you need?
Couldn't find anything in the reference. I'm looking for a way to get a list of all items in my AGO account.
You could try searching using an owner filter like:
gis.content.search("owner:my_username", max_items=1000)
If you authenticate with your account, then it should find everything you own.
The API reference above is correct. There is a search method which should do exactly what you need.
Maybe this script can help.
The output will export excel files contains all parameters like title, type, itemid, etc.
from arcgis.gis import GIS
import pandas as pd
portal = GIS("url portal", "username", "password")
#set "max_users" parameters in search() if you have more than 100 users in your portal
users_all = portal.users.search()
def get_item(user):
list_items = {}
content_item = user.items()
for item in content_item:
list_items[item.itemid] = item
folders = user.folders
for folder in folders :
folder_items = user.items(folder=folder['title'])
for item in folder_items:
list_items[item.itemid] = item
pd.DataFrame(list_items).transpose().to_excel(str(user.username)+'.xlsx')
for i in range(len(users_all)):
print("extract "+ str(users_all[i]) + "data to excel...")
get_item(users_all[i])
If I don't have an enterprise portal where does the Excel end up? It doesn't show up in my organization's content in AGO. The script seems to run fine and loops through my users, but I can't figure out where the exports are located.
Is there something I can add to the script to download the Excel after its been exported?
I know this is a bit old but you can just modify the script to specify an output location:
pd.DataFrame(list_items).transpose().to_excel('C:\\temp\\' + str(user.username)+'.xlsx')
@ConorMacNaughton wrote:If I don't have an enterprise portal where does the Excel end up? It doesn't show up in my organization's content in AGO. The script seems to run fine and loops through my users, but I can't figure out where the exports are located.
Is there something I can add to the script to download the Excel after its been exported?
Great script thanks.
The script is great! Thanks for sharing... I have been trying to perform this task but in my case, I just need to list the items inside a specific folder within AGOL's content folders. I like the way the original scripts outputs the table with title, type, itemid. Any assistance will be appreciated!