<?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: Loop through itemId in ArcGIS Enterprise Portal Questions</title>
    <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/loop-through-itemid/m-p/504145#M7042</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried this on my side, not too sure why it expects it to be an Online organization when the docs indicate it can be an ArcGIS Enterprise deployment:&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/461360_pastedImage_2.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/461338_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Might want to reach out to tech support or create an issue in the &lt;A href="https://github.com/Esri/arcgis-python-api/issues"&gt;arcgis-python-api&lt;/A&gt; repo to see what's going on.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 07 Oct 2019 20:24:20 GMT</pubDate>
    <dc:creator>JonathanQuinn</dc:creator>
    <dc:date>2019-10-07T20:24:20Z</dc:date>
    <item>
      <title>Loop through itemId</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/loop-through-itemid/m-p/504144#M7041</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;I am trying to loop through the Portal Gallery to get the itemId for all maps and/or apps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can get the itemId for a single app calling the item = xx&lt;/P&gt;&lt;P&gt;e.g.&lt;/P&gt;&lt;P&gt;# item = "6f91e6d30e8b4776b23dccb2fc560c94"&lt;BR /&gt;# print(i['numViews'])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I use the example in &lt;A href="https://esri.github.io/arcgis-python-api/apidoc/html/arcgis.apps.hub.html?highlight=itemid"&gt;https://esri.github.io/arcgis-python-api/apidoc/html/arcgis.apps.hub.html?highlight=itemid, get AttributeError: 'GIS' object has no attribute 'hub.id error.&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcgis&lt;BR /&gt;from arcgis.gis import GIS&lt;BR /&gt;from arcgis import apps&lt;BR /&gt;from arcgis.apps import hub&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;url = "&lt;A href="https://dev.maps.b-intra.net/portal/home/gallery.html"&gt;https://myarcgis.com/portal/home/gallery.html&lt;/A&gt;"&lt;/P&gt;&lt;P&gt;## &lt;A href="https://sslvwd1npxapp04.b-intra.net:7443/arcgis/home/content.html?start=1&amp;amp;view=grid&amp;amp;sortOrder=desc&amp;amp;sortField=modified&amp;amp;focus=applications-web&amp;amp;searchTerm=#organization"&gt;https://myarcgis.com:7443/arcgis/home/content.html?start=1&amp;amp;view=grid&amp;amp;sortOrder=desc&amp;amp;sortField=modified&amp;amp;focus=applications-web&amp;amp;searchTerm=#organization&lt;/A&gt;&lt;/P&gt;&lt;P&gt;## url = "&lt;A href="https://sslvwd1npxapp04.b-intra.net:7443/arcgis/home/content.html?sortOrder=desc&amp;amp;sortField=modified&amp;amp;focus=applications#organization"&gt;https://sslvwd1npxapp04.b-intra.net:7443/arcgis/home/content.html?sortOrder=desc&amp;amp;sortField=modified&amp;amp;focus=applications#organization&lt;/A&gt;"&lt;/P&gt;&lt;P&gt;### Make a connection to the portal&lt;BR /&gt;gis = GIS(url=url)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;myHub = gis.hub&lt;BR /&gt;a_Initiative = myHub.initiatives.get('itemId *')&lt;/P&gt;&lt;P&gt;for i in a_Initiative:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print(I)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe" C:/Temp/DEV/GetPortalViewCounts.py&lt;BR /&gt;Traceback (most recent call last):&lt;BR /&gt;&amp;nbsp; File "C:/Temp/DEV/GetPortalViewCounts.py", line 7, in &amp;lt;module&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; from arcgis.apps import hub&lt;BR /&gt;ImportError: cannot import name 'hub'&lt;/P&gt;&lt;P&gt;Process finished with exit code 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Clive&lt;/P&gt;&lt;PRE style="color: #a9b7c6; font-family: 'Courier New'; font-size: 9pt; background-color: #2b2b2b;"&gt;&lt;SPAN style="color: #808080;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Oct 2019 15:38:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/loop-through-itemid/m-p/504144#M7041</guid>
      <dc:creator>CliveSwan</dc:creator>
      <dc:date>2019-10-07T15:38:55Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through itemId</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/loop-through-itemid/m-p/504145#M7042</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried this on my side, not too sure why it expects it to be an Online organization when the docs indicate it can be an ArcGIS Enterprise deployment:&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/461360_pastedImage_2.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/461338_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Might want to reach out to tech support or create an issue in the &lt;A href="https://github.com/Esri/arcgis-python-api/issues"&gt;arcgis-python-api&lt;/A&gt; repo to see what's going on.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Oct 2019 20:24:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/loop-through-itemid/m-p/504145#M7042</guid>
      <dc:creator>JonathanQuinn</dc:creator>
      <dc:date>2019-10-07T20:24:20Z</dc:date>
    </item>
  </channel>
</rss>

