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 = 0lenght_searchresult = 100while 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 + 100for user in list_users:print(user.username)
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}")
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.