Export List of Portal Users with specific role type

02-10-2022 12:51 AM
Labels (1)
New Contributor III


I am trying to export list of all Portal Users with username, email, role, level, creation time, etc. 

I'm using ipynb in ArcGIS Pro and able to generate a csv file. However, I only have the User Level and the User Role, no User Type like(Viewer, Fieldworker and Creator) on the extracted reported.

Do you know the correct "keyword" to put on the script to have these details?

tried this below but only gives me : arcigsonly for the result.

'User_type': [usr:userType for usr in users],

this is the script I am using,






Thanks 🙂

0 Kudos
1 Reply
New Contributor III

Hi, Wondering if you ever figured this out? I'm using the code below, but I can't figure out how I can limit my output to just one role (Role = Viewer). 

import csv
from arcgis.gis import GIS

gis = GIS("<Portal URL>", "<UserName>", "<Password>", verify_cert=False)

outputFile = r"<Output File Location>"

users = gis.users.search('*', max_users=15000)

with open(outputFile, 'w', newline='') as ResultFile:
wr = csv.writer(ResultFile)
header = 'Username', 'Role', 'Email'
for user in users:
UserRow = user.username, user.role, user.email

0 Kudos