I'm trying to export a list of Portal users and their user types. This is the code I'm trying to use but getting an error regarding the user.LicenseTypeId entry:

import csv 
from arcgis.gis import GIS

gis = GIS("https://test.esri.com:7443/arcgis", "username", "password", verify_cert=False)

outputFile = r"C:\Users\Desktop\test.csv"

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

with open(outputFile, 'w', newline='') as ResultFile:
    wr = csv.writer(ResultFile)
    header = 'Username', 'Type', 'Email'
    for user in users:
        UserRow = user.username, user.LicenseTypeId, user.email
  • What is the precise and full error (including line number) you see when you run the code that you have presented?
    – PolyGeo
    Mar 10, 2023 at 21:13
  • Hi there: I receive this:
    – Jesse
    Mar 15, 2023 at 13:41
  • --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) In [2]: Line 15: UserRow = user.username, user.LicenseTypeId, user.email File C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\gis_init_.py, in getattr: Line 9461: raise AttributeError( AttributeError: 'User' object has no attribute 'LicenseTypeId' ---------------------------------------------------------------------------
    – Jesse
    Mar 15, 2023 at 13:41
  • Please use the edit button beneath your question to revise it with any requested clarifications.
    – PolyGeo
    Mar 16, 2023 at 4:19
  • I don't know if it's an available property of the user class but have you tried user.licenseTypeId in stead of user.LicenseTypeId?
    – PolyGeo
    Mar 16, 2023 at 4:21


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.