1

I want to have a list of the items inside a folder created by my user in AGOL, I want to use the ArcGIS API for Python.

so far I have found this:

import sys
from arcgis import gis
import os

sourceURL="https://yourAGOL.maps.arcgis.com"
sourceAdmin="adminUser"
sourcePassword="thisIsNotMyPassword"

clientAcronym = "Sales"
source = gis.GIS(sourceURL, sourceAdmin, sourcePassword)
existingItems = source.content.search('title:"{0}*" '.format(clientAcronym))

this code list all the items where their title start with Sales, but I know there is a folder called "Sales-Test" and it has some of those items, i want to know which items are inside of that folder:

if I get the list of my folders

me = source.users.me
me.folders
for folder in me.folders: 
    print(folder['title'])
    me.items(folder['title'])

I can see the folder "Sales-Test" but not he items inside it

In the Item documentation i cannot see how to get the folder information. Is there a way to relate the information of existingItems with me.folders?

1

what if you add this:

me = source.users.me
me.folders
for folder in me.folders: 
    print(folder['title'])
    me.items(folder['title'])
    itemsInFolders = me.items(folder=f['title'])  
    print(len(itemsInFolders))
    for i in itemsInFolders:
        print("      " +str(i))
  • could you please format your answer? – XtianGIS Dec 21 '18 at 16:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.