Incorrect results from arcgis.groups.search (ArcGIS Python API) for users owning more than 100 groups?

1085
1
Jump to solution
12-10-2016 07:15 AM
PeterKnoop
MVP Regular Contributor

When using arcgis.groups.search (from the ArcGIS Python API) to return the list of groups for a user on our ArcGIS Online instance, it appears to return incorrect results for users who own more than 100 groups. For instance:

from arcgis.gis import GIS

gis = GIS("<AGO URL>", "<admin username>", "<password>")
users = gis.users.search(query=None, sort_field='username', sort_order='asc', max_users=10000)

for user in users:
 groups_owner = "owner:" + user['username']
 groups_count = len(gis.groups.search(query=groups_owner, max_groups=1000))
 if( groups_count > 0 ):
 print(groups_owner, ",", groups_count)

For users owning more than 100 groups, the above appears to return a list that has as many items as the value of max_groups, regardless of how many groups the user actually owns. For instance, for each user owning more than 100 groups, the result list always has 1000 items. And, if you examine the returned list, it is composed of the first 100 groups repeated over and over until the max_groups value is reached. 

Anyone else run into this possible bug, and know a way around it?

Thanks!

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
PeterKnoop
MVP Regular Contributor

This is confirmed as a bug (BUG-000101507) with both the 0.3 beta and forthcoming 1.0 release of ArcGIS Python API.

View solution in original post

0 Kudos
1 Reply
PeterKnoop
MVP Regular Contributor

This is confirmed as a bug (BUG-000101507) with both the 0.3 beta and forthcoming 1.0 release of ArcGIS Python API.

0 Kudos