Select to view content in your preferred language

Python isn't finding map in folder

465
1
Jump to solution
08-03-2023 08:00 AM
Scoth
by
Occasional Contributor

I'm using the Python api to iterate through maps in one of my folders, and it is only finding some of them. All the maps were created by me, and have the exact same permissions and settings. In fact all of the maps were created by a script that saves a copy from a template, so I know they are exactly the same.

The maps are indeed in the folder. I can see them when I use my browser. I have no clue what's going on. 

Has anyone else had this issue?

Basic search code:

for item in gis.users.me.items(folder = FOLDER_NAME):
        if item.type == 'Web Map':
                print(item.title)

1 Solution

Accepted Solutions
Scoth
by
Occasional Contributor

Just got some help from ESRI and we figured out that iterating through the items in gis.users.me(folder=foldername) has a search limit, much like the gis.content.search() function. So my folder had too many items to iterate through, by default at least.

But the good news is the solution is to just add a "max_items" argument that is larger than your folder size.

Solution:

for item in gis.users.me.items(folder = FOLDER_NAME, max_items=200):
       print(item.title)

View solution in original post

1 Reply
Scoth
by
Occasional Contributor

Just got some help from ESRI and we figured out that iterating through the items in gis.users.me(folder=foldername) has a search limit, much like the gis.content.search() function. So my folder had too many items to iterate through, by default at least.

But the good news is the solution is to just add a "max_items" argument that is larger than your folder size.

Solution:

for item in gis.users.me.items(folder = FOLDER_NAME, max_items=200):
       print(item.title)