List of All GIS Online Users

162
1
11-30-2023 08:43 AM
Labels (2)
BAdejumo
New Contributor

When I used this for portal it worked but for ArcGIS Online it doesn't return the email.

source = GIS("https://meftonline.arcgisonline.com/home/index.html", "username", "password", verify_cert=False)
start = 0
lenght_searchresult = 100
while lenght_searchresult == 100:
source_users = source.users.advanced_search(query='!esri_ & !portaladmin', start = start, max_users = 100)
list_users = source_users.get('results')
lenght_searchresult = len(list_users)
start = start + 100
for user in list_users:
print(user.username)

Tags (1)
0 Kudos
1 Reply
BijanTaheri
New Contributor II

This should be a simpler way to do it:

 

# Connect to GIS
source = GIS(url, username, password)

# Get all users in GIS
source_users = source.users.search('!esri_ & !portaladmin',max_users=99999)

# Print username
for user in source_users:
    print(f"{user.username} | {user.email}")

 

 

0 Kudos