Using this example I am trying to loop through my Arcgis Online account using ArcREST
in order to download feature layers locally. However I have not been able to drill down into each folder to acquire each service name with .content
in order to run the .exportItem
. I can get the folder names but I can't get access to the feature layers
in the folders.
import os
import arcpy as env
import arcrest
import arcpy
arcpy.env.workspace = r"C:\xxx\temp"
uname = "xxx"
pword = "xxx"
site = "http://xxx.xxx.arcgis.com"
sh = arcrest.AGOLTokenSecurityHandler(uname,pword,site)
admin = arcrest.manageorg.administration.Administration(securityHandler=sh)
content = admin.content
user = content.users.user(uname)
for folder in user.folders:
print folder
#This line below was added after original post
for sub_folder in folder:
print sub_folder
Edit: added a for loop
within the original loop to attempt to access the contents of the folders. The variable sub_folder
prints only the contents of the root folder
for folder in user.folders: for subfolder in folder: print subfolder.items