Freeego
Freeego

Reputation: 135

How to get all items in a folder in ArcGIS Online with Python?

I'm beginning to use Python to work around ArcGIS Online. Does anyone know how to get all items in a folder in ArcGIS Online with Python code?

I tried these ones but not work:

items = gis_online.content.search(query=f"folderid:{source_folder_id}")
items = gis_online.content.get(source_folder_id)

Thanks!

Upvotes: 0

Views: 705

Answers (1)

jakethesnake
jakethesnake

Reputation: 1

from arcgis.gis import GIS
from arcgis.gis import User

gis = GIS('Connect to GIS however you normally do')

#Get user that owns folder
user = gis.users.get("Add username")

#Get list of items
list = user.items(folder='Add your folder name')

This will return user items which can then get the item.id or item.title etc.

Upvotes: 0

Related Questions