<?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: How to query all groups in an ArcGIS Online organization using the ArcGIS API for Python in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-query-all-groups-in-an-arcgis-online/m-p/732734#M214</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you.&amp;nbsp; That was the ticket!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's some new code you can run the Pro python window.&amp;nbsp; Not pretty at all, but it does print the title and list of users from the group.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;from arcgis.gis import GIS &lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;gis = GIS("pro")&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;all_groups = gis.groups.search('1=1') &lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;for group in all_groups: &lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; members = group.get_members() &lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; users_list = members['users']&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; users_string = ','.join(users_list)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; print(group.title + '...' + users_string)&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 08 Aug 2019 13:44:22 GMT</pubDate>
    <dc:creator>AndrewRudin1</dc:creator>
    <dc:date>2019-08-08T13:44:22Z</dc:date>
    <item>
      <title>How to query all groups in an ArcGIS Online organization using the ArcGIS API for Python</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-query-all-groups-in-an-arcgis-online/m-p/732732#M212</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I want to get a report of all groups in AGOL and their user count via the ArcGIS API for Python. I cannot figure out how to get the&amp;nbsp;&lt;SPAN&gt;gis.groups.search() function to return all groups.&amp;nbsp; All the Esri examples have some sort of text filter applied.&amp;nbsp;&amp;nbsp;The code I'm running from the ArcGIS Pro Python window is below.&amp;nbsp; At first I tried using the syntax &lt;STRONG&gt;gis.groups.search()&lt;/STRONG&gt;, but this returns the error&amp;nbsp;&lt;STRONG style="color: #ff0000;"&gt;RuntimeError: Unable to perform group search.'q' parameter must be specified.&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt;&amp;nbsp; Then I tried&amp;nbsp;&lt;STRONG&gt;gis.groups.search('*')&lt;/STRONG&gt;, which ran without error, but the result is an empty set.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;SPAN style="color: #000000; text-decoration: underline;"&gt;Sample code run from ArcGIS Pro Python window:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;EM&gt;from arcgis.gis import GIS&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;EM&gt;&lt;SPAN&gt;gis = GIS("&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fmyorg.maps.arcgis.com" rel="nofollow" target="_blank"&gt;https://myorg.maps.arcgis.com&lt;/A&gt;&lt;SPAN&gt;",clientid='myclientid') &lt;/SPAN&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;EM&gt;all_groups = gis.groups.search() &lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;EM&gt;for group in all_groups: &lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;members = group.get_members() &lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;print(str(len(members)))&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jun 2018 14:26:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-query-all-groups-in-an-arcgis-online/m-p/732732#M212</guid>
      <dc:creator>AndrewRudin1</dc:creator>
      <dc:date>2018-06-13T14:26:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to query all groups in an ArcGIS Online organization using the ArcGIS API for Python</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-query-all-groups-in-an-arcgis-online/m-p/732733#M213</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Instead of passing "*" pass "1=1"&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Aug 2019 12:04:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-query-all-groups-in-an-arcgis-online/m-p/732733#M213</guid>
      <dc:creator>ChadBiggerstaff2</dc:creator>
      <dc:date>2019-08-08T12:04:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to query all groups in an ArcGIS Online organization using the ArcGIS API for Python</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-query-all-groups-in-an-arcgis-online/m-p/732734#M214</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you.&amp;nbsp; That was the ticket!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's some new code you can run the Pro python window.&amp;nbsp; Not pretty at all, but it does print the title and list of users from the group.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;from arcgis.gis import GIS &lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;gis = GIS("pro")&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;all_groups = gis.groups.search('1=1') &lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;for group in all_groups: &lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; members = group.get_members() &lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; users_list = members['users']&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; users_string = ','.join(users_list)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; print(group.title + '...' + users_string)&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Aug 2019 13:44:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-query-all-groups-in-an-arcgis-online/m-p/732734#M214</guid>
      <dc:creator>AndrewRudin1</dc:creator>
      <dc:date>2019-08-08T13:44:22Z</dc:date>
    </item>
  </channel>
</rss>

