<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to Get all the users in Portal (more than 10,000) in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-get-all-the-users-in-portal-more-than-10/m-p/1194246#M7578</link>
    <description>&lt;P&gt;Hi There, I am trying to build a script that searches all the users and their last login in our portal environment (10.9.1). The code snippet below works fine but it has a limit of 10000.&amp;nbsp; I found that&amp;nbsp;&amp;nbsp;advanced_search allows returns all the users but I am not able to get the right syntax.&amp;nbsp;Just wanted to check the proper syntax for a search that brings all the users.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&amp;nbsp;search = gis.content.advanced_search(query='', max_items=100)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;users = arcgis.gis.UserManager(gis)
allUsers = users.search(query = '*', max_users = 10000)

     for user in allUsers:
            if user.lastLogin != -1:
                last_accessed = time.localtime(user.lastLogin/1000)&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 20 Jul 2022 23:35:26 GMT</pubDate>
    <dc:creator>Sunnywaygis</dc:creator>
    <dc:date>2022-07-20T23:35:26Z</dc:date>
    <item>
      <title>How to Get all the users in Portal (more than 10,000)</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-get-all-the-users-in-portal-more-than-10/m-p/1194246#M7578</link>
      <description>&lt;P&gt;Hi There, I am trying to build a script that searches all the users and their last login in our portal environment (10.9.1). The code snippet below works fine but it has a limit of 10000.&amp;nbsp; I found that&amp;nbsp;&amp;nbsp;advanced_search allows returns all the users but I am not able to get the right syntax.&amp;nbsp;Just wanted to check the proper syntax for a search that brings all the users.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&amp;nbsp;search = gis.content.advanced_search(query='', max_items=100)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;users = arcgis.gis.UserManager(gis)
allUsers = users.search(query = '*', max_users = 10000)

     for user in allUsers:
            if user.lastLogin != -1:
                last_accessed = time.localtime(user.lastLogin/1000)&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2022 23:35:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-get-all-the-users-in-portal-more-than-10/m-p/1194246#M7578</guid>
      <dc:creator>Sunnywaygis</dc:creator>
      <dc:date>2022-07-20T23:35:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to Get all the users in Portal (more than 10,000)</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-get-all-the-users-in-portal-more-than-10/m-p/1194254#M7579</link>
      <description>&lt;P&gt;I don't have that many users to adequately test, but usually setting the&amp;nbsp;&lt;STRONG&gt;max_users&lt;/STRONG&gt; parameter to&amp;nbsp;&lt;STRONG&gt;-1&lt;/STRONG&gt; does the trick. Do you still hit the 10000 limit with that?&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2022 23:54:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-get-all-the-users-in-portal-more-than-10/m-p/1194254#M7579</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-07-20T23:54:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to Get all the users in Portal (more than 10,000)</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-get-all-the-users-in-portal-more-than-10/m-p/1194317#M7580</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/469120"&gt;@Sunnywaygis&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Well usually&amp;nbsp;&amp;nbsp;&amp;nbsp;I would use the below code to get the users but going over 10 000 there seems to be some hard limit so you can use the below code and specify the users manually or get them through a rest query,&lt;/P&gt;&lt;P&gt;I would also query and use the users one at a time because you are downloading a lot of objects. but the below code will download all the users of a enterprise we also add the portal_id for AGOL otherwise you get public content and the !_esri to ignore Esri built in users.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;user_manager = arcgis.gis.UserManager(con)
portal_id = 0123456789ABCDEF # for arcgis enterprise only
users_count = user_manager.advanced_search(query=f"{portal_id} AND !_esri", return_count=True)

users = []
for user_num in range(1,users_count +1):
    try:
        user = user_manager.advanced_search(query=f"{portal_id} AND !_esri",start=user_num, max_users=1)
        users.append(user)
    except Exception as e:
        print(f"User {user_num} failed")
for user in users:
    print(user)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2022 06:06:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-get-all-the-users-in-portal-more-than-10/m-p/1194317#M7580</guid>
      <dc:creator>HenryLindemann</dc:creator>
      <dc:date>2022-07-21T06:06:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to Get all the users in Portal (more than 10,000)</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-get-all-the-users-in-portal-more-than-10/m-p/1194785#M7586</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;jcarlson for your suggestion. We dont have 10,000 users at this time, I dont have a way to test this but I wanted to script to accommodate for this scenario.&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV class=""&gt;&lt;A href="https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-get-all-the-users-in-portal-more-than-10/m-p/1194317#" target="_blank" rel="noopener"&gt;PREVIEW&lt;/A&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 22 Jul 2022 02:46:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-get-all-the-users-in-portal-more-than-10/m-p/1194785#M7586</guid>
      <dc:creator>Sunnywaygis</dc:creator>
      <dc:date>2022-07-22T02:46:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to Get all the users in Portal (more than 10,000)</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-get-all-the-users-in-portal-more-than-10/m-p/1194786#M7587</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;A href="https://community.esri.com/t5/user/viewprofilepage/user-id/400739" target="_self"&gt;&lt;SPAN class=""&gt;HenryLindemann&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;for the code snippet. I will give this a try and this working. We still wont know until we cross 10,000 user limit.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again for your help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jul 2022 02:50:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-get-all-the-users-in-portal-more-than-10/m-p/1194786#M7587</guid>
      <dc:creator>Sunnywaygis</dc:creator>
      <dc:date>2022-07-22T02:50:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to Get all the users in Portal (more than 10,000)</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-get-all-the-users-in-portal-more-than-10/m-p/1660476#M11751</link>
      <description>&lt;P&gt;Hello&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Thanks for sharing&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/400739"&gt;@HenryLindemann&lt;/a&gt;.&lt;/P&gt;&lt;P&gt;I am facing the same issue. Need to run a routine over all my users and I now have 12000. I tested your sample and on my side running:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;users_count = user_manager.advanced_search(query=f"{portal_id} AND !_esri", return_count=True)&lt;/LI-CODE&gt;&lt;P&gt;returns: 10000... So the hard limit remains.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am thinking about iterating through the alphabet 'a*', 'b*', ... 'z*':&lt;/P&gt;&lt;LI-CODE lang="python"&gt;users = user_manager.advanced_search(query=f"{portal_id} AND !_esri AND username:a*") &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any other (cleverer) idea by any chance ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Oct 2025 14:16:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-get-all-the-users-in-portal-more-than-10/m-p/1660476#M11751</guid>
      <dc:creator>NicolasGIS</dc:creator>
      <dc:date>2025-10-24T14:16:29Z</dc:date>
    </item>
  </channel>
</rss>

