Select to view content in your preferred language

How to populate all org ArcGIS Online account Bio sections with account email addresses

413
1
04-19-2023 08:39 PM
Labels (1)
Will
by
Occasional Contributor II

Hi!  I'm an ArcGIS Online admin of an org with ~470 accounts looking for a script or tool or routine to populate (append) the associated email address for each account to its Bio section so that our users can see this info without being an admin.  I use GeoJobe's free Admin tools, but they don't have an option to do this by looping through each account and pull each email address as a variable.  I'm new to code-based admin for the ArcGIS Online environment so any leads/tips/explanations would be greatly appreciated!

 

0 Kudos
1 Reply
JoshuaSharp-Heward
Occasional Contributor III

Hi Will,

From looking at the api I think the bio is the "description" for a user. If so, the following code should do the trick:

from arcgis.gis import GIS
gis = GIS("home")
users = gis.users.search(max_users=500)
for user in users:
    email = user.email
    user.update(description = email)
    #bio = user.description
    #bio = email + "\n" + bio
    #user.update(description = bio)

I've included a couple commented out lines there just in case you want to keep the user's current bio and just put the email on a line in front of it, otherwise it'll just be overwritten! Just run it from an ArcGIS Notebook in AGOL/Enterprise. And if you want to test that it'll do what you're intending it to do you can put a print statement in there in place of the user.update.

Hope that helps.

Cheers,

Josh