<?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: Search for Views Created from a User Provided Feature Layer in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/search-for-views-created-from-a-user-provided/m-p/1135720#M7025</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/471562"&gt;@JaimieNevins2&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Here's a sample script which lists all the layer views of a hosted feature layer:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis import GIS
from arcgis.features import FeatureLayerCollection

gis = GIS("portal_url", "username", "password")

source_item = gis.content.search("feature_layer")[0]
flc = FeatureLayerCollection.fromitem(source_item)
for view in flc.layers[0].manager.properties.adminLayerInfo.layerViews:
    print(view.serviceName)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;Mehdi&lt;/P&gt;</description>
    <pubDate>Fri, 21 Jan 2022 02:24:03 GMT</pubDate>
    <dc:creator>MehdiPira1</dc:creator>
    <dc:date>2022-01-21T02:24:03Z</dc:date>
    <item>
      <title>Search for Views Created from a User Provided Feature Layer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/search-for-views-created-from-a-user-provided/m-p/1135612#M7023</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looking for a way to query all the Views created from a provided Feature Layer.&amp;nbsp; In AGOL, this information is provided on the Overview page under the Details : Other Views (see below).&amp;nbsp; How do I access this&amp;nbsp; data using ArcGIS API for Python?&lt;/P&gt;&lt;P&gt;Thanks in advanced!&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JaimieNevins2_0-1642708724674.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/31928iA5B0CF227F77F421/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JaimieNevins2_0-1642708724674.png" alt="JaimieNevins2_0-1642708724674.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jan 2022 20:02:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/search-for-views-created-from-a-user-provided/m-p/1135612#M7023</guid>
      <dc:creator>JaimieNevins2</dc:creator>
      <dc:date>2022-01-20T20:02:15Z</dc:date>
    </item>
    <item>
      <title>Re: Search for Views Created from a User Provided Feature Layer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/search-for-views-created-from-a-user-provided/m-p/1135720#M7025</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/471562"&gt;@JaimieNevins2&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Here's a sample script which lists all the layer views of a hosted feature layer:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis import GIS
from arcgis.features import FeatureLayerCollection

gis = GIS("portal_url", "username", "password")

source_item = gis.content.search("feature_layer")[0]
flc = FeatureLayerCollection.fromitem(source_item)
for view in flc.layers[0].manager.properties.adminLayerInfo.layerViews:
    print(view.serviceName)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;Mehdi&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jan 2022 02:24:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/search-for-views-created-from-a-user-provided/m-p/1135720#M7025</guid>
      <dc:creator>MehdiPira1</dc:creator>
      <dc:date>2022-01-21T02:24:03Z</dc:date>
    </item>
    <item>
      <title>Re: Search for Views Created from a User Provided Feature Layer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/search-for-views-created-from-a-user-provided/m-p/1135824#M7028</link>
      <description>&lt;P&gt;Thank you so much!&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jan 2022 15:12:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/search-for-views-created-from-a-user-provided/m-p/1135824#M7028</guid>
      <dc:creator>JaimieNevins2</dc:creator>
      <dc:date>2022-01-21T15:12:04Z</dc:date>
    </item>
    <item>
      <title>Re: Search for Views Created from a User Provided Feature Layer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/search-for-views-created-from-a-user-provided/m-p/1136247#M7032</link>
      <description>&lt;P&gt;Not a problem&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/471562"&gt;@JaimieNevins2&lt;/a&gt;.&lt;/P&gt;&lt;P&gt;If my reply has answered your question, could you please Accept as Solution?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jan 2022 00:35:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/search-for-views-created-from-a-user-provided/m-p/1136247#M7032</guid>
      <dc:creator>MehdiPira1</dc:creator>
      <dc:date>2022-01-24T00:35:03Z</dc:date>
    </item>
    <item>
      <title>Re: Search for Views Created from a User Provided Feature Layer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/search-for-views-created-from-a-user-provided/m-p/1190725#M7547</link>
      <description>&lt;P&gt;Here's an additional solution, to complement&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/43250"&gt;@MehdiPira1&lt;/a&gt;'s.&lt;/P&gt;&lt;P&gt;You can get a list&amp;nbsp;of items that are views of a hosted feature layer by calling &lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#arcgis.gis.Item.related_items" target="_blank" rel="noopener"&gt;related_items&lt;/A&gt;&amp;nbsp;with rel_type="Service2Service" and direction="forward":&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcgis
gis = arcgis.gis.GIS("home")
hfl_item = gis.content.get("...")
views_items = hfl_item.related_items(rel_type="Service2Service", direction="forward")
for view_item in view_items:
    print(view_item.title)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Conversely, you can get the source hosted feature layer for a view item by calling related_items with rel_type="Service2Service" and direction="reverse":&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# Returns a list containing only one item.
source_hfl = item.related_items(rel_type="Service2Service", direction="reverse")
source_hfl = source_hfl[0]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2022 04:12:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/search-for-views-created-from-a-user-provided/m-p/1190725#M7547</guid>
      <dc:creator>TristanMcHardie</dc:creator>
      <dc:date>2022-07-08T04:12:47Z</dc:date>
    </item>
    <item>
      <title>Re: Search for Views Created from a User Provided Feature Layer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/search-for-views-created-from-a-user-provided/m-p/1252319#M8316</link>
      <description>&lt;P&gt;How can we get related items of a view ?&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jan 2023 13:42:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/search-for-views-created-from-a-user-provided/m-p/1252319#M8316</guid>
      <dc:creator>GunaNandeeshUppu</dc:creator>
      <dc:date>2023-01-27T13:42:19Z</dc:date>
    </item>
  </channel>
</rss>

