<?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 Re: User's group list in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/user-s-group-list/m-p/1117353#M75303</link>
    <description>&lt;P&gt;I was wondering if you need to be logged in under an admin account to access all groups for a list of users? My current script is throwing an error when I try to list user.groups.&amp;nbsp; Am I missing something?&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt;File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\__init__.py", line 6675, in __getitem__&lt;BR /&gt;return dict.__getitem__(self, k)&lt;BR /&gt;KeyError: 'groups'&lt;/P&gt;&lt;P&gt;During handling of the above exception, another exception occurred:&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt;File "&amp;lt;string&amp;gt;", line 3, in &amp;lt;module&amp;gt;&lt;BR /&gt;File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\__init__.py", line 6856, in groups&lt;BR /&gt;return [Group(self._gis, group['id']) for group in self['groups']]&lt;BR /&gt;File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\__init__.py", line 6679, in __getitem__&lt;BR /&gt;return dict.__getitem__(self, k)&lt;BR /&gt;KeyError: 'groups'&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;P&gt;#total number of users in AGOL&amp;nbsp;&lt;BR /&gt;totalUsers = users.counts('user_type', as_df=False)[0]['count']&lt;/P&gt;&lt;P&gt;allUsers = users.search(query=None, max_users=totalUsers)&lt;/P&gt;&lt;P&gt;for user in allUsers:&lt;/P&gt;&lt;P&gt;if user.lastLogin != -1:&lt;BR /&gt;print (user.fullName, ",", user.idpUsername, ",", user.id, ",", user.groups, ",", user.storageUsage, ",", user.storageQuota, ",", datetime.datetime.fromtimestamp(user.created/1000).strftime('%Y-%m-%d'), ",", datetime.datetime.fromtimestamp(user.lastLogin/1000).strftime('%Y-%m-%d'))&lt;/P&gt;</description>
    <pubDate>Tue, 16 Nov 2021 18:19:26 GMT</pubDate>
    <dc:creator>JaimieNevins2</dc:creator>
    <dc:date>2021-11-16T18:19:26Z</dc:date>
    <item>
      <title>User's group list</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/user-s-group-list/m-p/95676#M8769</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Using the portal API, how can I get a list of all the groups that a user is a member?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Sep 2019 19:33:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/user-s-group-list/m-p/95676#M8769</guid>
      <dc:creator>PierreMasson</dc:creator>
      <dc:date>2019-09-06T19:33:36Z</dc:date>
    </item>
    <item>
      <title>Re: User's group list</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/user-s-group-list/m-p/95677#M8770</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nevermind! Got it:&amp;nbsp;&lt;/P&gt;&lt;PRE style="color: #000000; background-color: #eeeeee; border: 1px dashed #c2c4ba; font-size: 11.44px; margin-left: 15px; padding: 10px 10px 25px;"&gt;&lt;CODE&gt;http://www.arcgis.com/sharing/rest/community/users/jsmith&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Sep 2019 19:44:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/user-s-group-list/m-p/95677#M8770</guid>
      <dc:creator>PierreMasson</dc:creator>
      <dc:date>2019-09-06T19:44:11Z</dc:date>
    </item>
    <item>
      <title>Re: User's group list</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/user-s-group-list/m-p/95678#M8771</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here's another way with python&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;from arcgis.gis import GIS
gis = GIS("&lt;A href="https://maps.cob.org/portal" rel="nofollow noopener noreferrer" target="_blank"&gt;https://&amp;lt;your portal URL&amp;gt;/portal&lt;/A&gt;", "&amp;lt;your username&amp;gt;","&amp;lt;your password&amp;gt;")
oneUser = gis.users.search("&amp;lt;username&amp;gt;")
for i in oneUser:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print(i.groups)

# or you can get multiple users# myUsers = gis.users.search("*")# then list the groups for those users# for i in myUsers :#&amp;nbsp;&amp;nbsp;&amp;nbsp; print(i.username, "&amp;nbsp; ", i.groups)
# see &lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#user" rel="nofollow noopener noreferrer" target="_blank"&gt;https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#user&lt;/A&gt;
# for other things you can print out for each user
# see &lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#usermanager" rel="nofollow noopener noreferrer" target="_blank"&gt;https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#usermanager&lt;/A&gt;
# for ways to search and sort users&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:00:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/user-s-group-list/m-p/95678#M8771</guid>
      <dc:creator>AnnStark2</dc:creator>
      <dc:date>2021-12-12T16:00:52Z</dc:date>
    </item>
    <item>
      <title>Re: User's group list</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/user-s-group-list/m-p/95679#M8772</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Feel free to mark this question as answered, even if you provided the answer yourself.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Feb 2020 23:43:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/user-s-group-list/m-p/95679#M8772</guid>
      <dc:creator>Noah-Sager</dc:creator>
      <dc:date>2020-02-13T23:43:08Z</dc:date>
    </item>
    <item>
      <title>Re: User's group list</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/user-s-group-list/m-p/95680#M8773</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A _jive_internal="true" data-userid="374569" data-username="pmasson" href="https://community.esri.com/people/pmasson" style="background-color: transparent; border-image-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; border-image-source: none; border-image-width: 1; color: #8ca9cd; fill: #8ca9cd; font-family: arial,helvetica,&amp;amp;quot; helvetica neue&amp;amp;quot;,verdana,sans-serif; font-size: 13.6px; font-style: normal; font-variant: normal; font-weight: 600; letter-spacing: normal; orphans: 2; outline-color: invert; outline-style: none; outline-width: 0px; text-align: center; text-decoration: none; text-indent: 0px; text-transform: none; transition-delay: 0s; transition-duration: 0.1s; transition-property: color; transition-timing-function: cubic-bezier(0, 0, 1, 1); vertical-align: baseline; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px; padding: 0px; margin: 0px; border: 0px none #8ca9cd;"&gt;Pierre Masson&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another way to do this is to find who has the Portal Admin access, they will be able to go through the Organization&lt;/P&gt;&lt;P&gt;tab choose &lt;EM&gt;manage members&lt;/EM&gt;, find the Individual's name, next to their name is three dots &lt;STRONG&gt;...&lt;/STRONG&gt; , click that and in the drop down choose view groups.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This may be an easier process in future.&lt;/P&gt;&lt;P&gt;Kind Regards&lt;/P&gt;&lt;P&gt;Keiren&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Feb 2020 05:11:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/user-s-group-list/m-p/95680#M8773</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2020-02-14T05:11:38Z</dc:date>
    </item>
    <item>
      <title>Re: User's group list</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/user-s-group-list/m-p/1117353#M75303</link>
      <description>&lt;P&gt;I was wondering if you need to be logged in under an admin account to access all groups for a list of users? My current script is throwing an error when I try to list user.groups.&amp;nbsp; Am I missing something?&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt;File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\__init__.py", line 6675, in __getitem__&lt;BR /&gt;return dict.__getitem__(self, k)&lt;BR /&gt;KeyError: 'groups'&lt;/P&gt;&lt;P&gt;During handling of the above exception, another exception occurred:&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt;File "&amp;lt;string&amp;gt;", line 3, in &amp;lt;module&amp;gt;&lt;BR /&gt;File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\__init__.py", line 6856, in groups&lt;BR /&gt;return [Group(self._gis, group['id']) for group in self['groups']]&lt;BR /&gt;File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\__init__.py", line 6679, in __getitem__&lt;BR /&gt;return dict.__getitem__(self, k)&lt;BR /&gt;KeyError: 'groups'&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;P&gt;#total number of users in AGOL&amp;nbsp;&lt;BR /&gt;totalUsers = users.counts('user_type', as_df=False)[0]['count']&lt;/P&gt;&lt;P&gt;allUsers = users.search(query=None, max_users=totalUsers)&lt;/P&gt;&lt;P&gt;for user in allUsers:&lt;/P&gt;&lt;P&gt;if user.lastLogin != -1:&lt;BR /&gt;print (user.fullName, ",", user.idpUsername, ",", user.id, ",", user.groups, ",", user.storageUsage, ",", user.storageQuota, ",", datetime.datetime.fromtimestamp(user.created/1000).strftime('%Y-%m-%d'), ",", datetime.datetime.fromtimestamp(user.lastLogin/1000).strftime('%Y-%m-%d'))&lt;/P&gt;</description>
      <pubDate>Tue, 16 Nov 2021 18:19:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/user-s-group-list/m-p/1117353#M75303</guid>
      <dc:creator>JaimieNevins2</dc:creator>
      <dc:date>2021-11-16T18:19:26Z</dc:date>
    </item>
  </channel>
</rss>

