<?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 Identify sharing status of Items in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-identify-sharing-status-of-items/m-p/1662824#M11768</link>
    <description>&lt;P&gt;If you have a lot of content in your organization, you will find it faster to include your search constraints directly in the search. Such an approach is identical to what happens when you use the GUI for searches like this.&lt;/P&gt;&lt;P&gt;For example, if you want to get a list of items "shared to the world" in the GUI, then you would go to the Content view, and filter Sharing to "Everyone (public)". The equivalent with the ArcGIS API for Python is the Item&amp;nbsp;&lt;A href="https://developers.arcgis.com/python/latest/api-reference/arcgis.gis.toc.html#arcgis.gis.ContentManager.search" target="_self"&gt;search()&lt;/A&gt;&amp;nbsp;method, including the "access" parameter to filter on a sharing level of "public":&lt;/P&gt;&lt;LI-CODE lang="python"&gt;publicly_shared_items = gis.content.search(
    query = "1=1",            # scopes search to examine all content
    filter = "access:public"  # filters results to publicly accessible content
)&lt;/LI-CODE&gt;&lt;P&gt;If you do have a lot of content in your organization, then I would recommend switching from search() to&amp;nbsp;&lt;A href="https://developers.arcgis.com/python/latest/api-reference/arcgis.gis.toc.html#arcgis.gis.ContentManager.advanced_search" target="_self"&gt;advanced_search()&lt;/A&gt;, as the latter supports paging for efficiency and improved performance.&lt;/P&gt;&lt;P&gt;(Also, use the search method's filter parameter, rather than query, to specify "access:public". Filter is the preferred option when you want to search for exact parameter values; see &lt;A href="https://developers.arcgis.com/rest/users-groups-and-items/search-reference/#query-vs-filter" target="_self"&gt;Query Vs Filter&lt;/A&gt; in the underlying REST API.)&lt;/P&gt;&lt;P&gt;For identifying a list of items "&lt;SPAN&gt;shared to specific groups", the starting point in the GUI would be to go to each group and view their content. Similarly, with the ArcGIS API for Python, you would use the Group&amp;nbsp;&lt;A href="https://developers.arcgis.com/python/latest/api-reference/arcgis.gis.toc.html#arcgis.gis.Group.search" target="_self"&gt;search()&lt;/A&gt; method to generate a list of items shared to a group:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# Retrieve the group whose contents you want to list.
# (You could also search for the group by title or other properties using GroupManager's search method.)
group = gis.group.get('id_of_group')
# Retrieve a list of items shared with the group.
items_shared_with_group = group.search(
    query = "*"
)&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;If you expect any group to have more than 100 items shared with it, then leverage the paging support in the Group &lt;A href="https://developers.arcgis.com/python/latest/api-reference/arcgis.gis.toc.html#arcgis.gis.Group.search" target="_self"&gt;search()&lt;/A&gt; method. For example, expanding on the above example:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# Retrieve the group whose contents you want to list.
# (You could also search for the group by title or other properties using GroupManager's search method.)
group = gis.group.get('id_of_group')
# Compile a list of items shared with the group.
items_shared_with_group = []
# Set initial record start parameter to 0. This will be incremented for each search batch.
next_start = 0
# Loop until there are no more search results to return, as indicated by nextStart = -1.
while(next_start != -1):
    # Retrieve batch of search results
    result = group.search(
        query = "1=1",         # scopes search to examine all content
        max_items = 100,       # do not set higher than 100, or a bug will return duplicate results
        start = next_start     # start from end of last batch of search results
    )
    # If there are results returned, add them to the list of items shared with the group.
    if( 'results' in result ):
        items_shared_with_group.extend(result['results'])
    # Update the starting record for the next batch (-1 indicates no more batches to return)
    next_start = result['nextStart']
# Display count of items found shared with group
print(len(items_shared_with_group))&lt;/LI-CODE&gt;&lt;P&gt;And, if you want to generate a list of items across multiple groups, then wrap the above code block with another loop that iterates through each group, and generates an overall, aggregated list of items.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 03 Nov 2025 15:31:52 GMT</pubDate>
    <dc:creator>PeterKnoop</dc:creator>
    <dc:date>2025-11-03T15:31:52Z</dc:date>
    <item>
      <title>How to Identify sharing status of Items</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-identify-sharing-status-of-items/m-p/1662702#M11764</link>
      <description>&lt;P&gt;Reading the API documentation here:&lt;BR /&gt;&lt;A href="https://developers.arcgis.com/documentation/portal-and-data-services/portal-service/content-items/how-to-work-with-items/" target="_blank"&gt;https://developers.arcgis.com/documentation/portal-and-data-services/portal-service/content-items/how-to-work-with-items/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I am not seeing the ability to generate a list of all items&amp;nbsp; shared to the world or shared to specific groups for example.&lt;BR /&gt;I would assume I should be able to do something like:&lt;BR /&gt;&lt;BR /&gt;List all items.&lt;BR /&gt;for each item&lt;BR /&gt;&amp;nbsp; &amp;nbsp; identify sharing status (owner, org, to the world, list of groups)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; if shared to the world&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; do something&lt;BR /&gt;&lt;BR /&gt;Is this not possible?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;James&lt;/P&gt;</description>
      <pubDate>Sat, 01 Nov 2025 22:02:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-identify-sharing-status-of-items/m-p/1662702#M11764</guid>
      <dc:creator>JamesHood</dc:creator>
      <dc:date>2025-11-01T22:02:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to Identify sharing status of Items</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-identify-sharing-status-of-items/m-p/1662709#M11765</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/6923"&gt;@JamesHood&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You are looking for the Item object SharingManager &lt;A href="https://developers.arcgis.com/python/latest/api-reference/arcgis.gis.toc.html#arcgis.gis._impl._content_manager.SharingManager.shared_with" target="_blank" rel="noopener"&gt;shared_with property&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;This should help get you started...&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS

agol = GIS("home")

items = agol.content.search(query="", max_items=10000)

for item in items:
    share_details = item.sharing.shared_with
    if share_details["level"].value == "EVERYONE":
        print("Shared Publicly")
    elif share_details["level"].value == "PRIVATE":
        print("Shared with Owner")
    elif share_details["level"].value == "ORGANIZATION":
        print("Shared with Organization")

    print("In these groups: ", [g.title for g in share_details["groups"]])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All the best,&lt;/P&gt;&lt;P&gt;Glen&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 02 Nov 2025 11:12:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-identify-sharing-status-of-items/m-p/1662709#M11765</guid>
      <dc:creator>Clubdebambos</dc:creator>
      <dc:date>2025-11-02T11:12:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to Identify sharing status of Items</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-identify-sharing-status-of-items/m-p/1662824#M11768</link>
      <description>&lt;P&gt;If you have a lot of content in your organization, you will find it faster to include your search constraints directly in the search. Such an approach is identical to what happens when you use the GUI for searches like this.&lt;/P&gt;&lt;P&gt;For example, if you want to get a list of items "shared to the world" in the GUI, then you would go to the Content view, and filter Sharing to "Everyone (public)". The equivalent with the ArcGIS API for Python is the Item&amp;nbsp;&lt;A href="https://developers.arcgis.com/python/latest/api-reference/arcgis.gis.toc.html#arcgis.gis.ContentManager.search" target="_self"&gt;search()&lt;/A&gt;&amp;nbsp;method, including the "access" parameter to filter on a sharing level of "public":&lt;/P&gt;&lt;LI-CODE lang="python"&gt;publicly_shared_items = gis.content.search(
    query = "1=1",            # scopes search to examine all content
    filter = "access:public"  # filters results to publicly accessible content
)&lt;/LI-CODE&gt;&lt;P&gt;If you do have a lot of content in your organization, then I would recommend switching from search() to&amp;nbsp;&lt;A href="https://developers.arcgis.com/python/latest/api-reference/arcgis.gis.toc.html#arcgis.gis.ContentManager.advanced_search" target="_self"&gt;advanced_search()&lt;/A&gt;, as the latter supports paging for efficiency and improved performance.&lt;/P&gt;&lt;P&gt;(Also, use the search method's filter parameter, rather than query, to specify "access:public". Filter is the preferred option when you want to search for exact parameter values; see &lt;A href="https://developers.arcgis.com/rest/users-groups-and-items/search-reference/#query-vs-filter" target="_self"&gt;Query Vs Filter&lt;/A&gt; in the underlying REST API.)&lt;/P&gt;&lt;P&gt;For identifying a list of items "&lt;SPAN&gt;shared to specific groups", the starting point in the GUI would be to go to each group and view their content. Similarly, with the ArcGIS API for Python, you would use the Group&amp;nbsp;&lt;A href="https://developers.arcgis.com/python/latest/api-reference/arcgis.gis.toc.html#arcgis.gis.Group.search" target="_self"&gt;search()&lt;/A&gt; method to generate a list of items shared to a group:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# Retrieve the group whose contents you want to list.
# (You could also search for the group by title or other properties using GroupManager's search method.)
group = gis.group.get('id_of_group')
# Retrieve a list of items shared with the group.
items_shared_with_group = group.search(
    query = "*"
)&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;If you expect any group to have more than 100 items shared with it, then leverage the paging support in the Group &lt;A href="https://developers.arcgis.com/python/latest/api-reference/arcgis.gis.toc.html#arcgis.gis.Group.search" target="_self"&gt;search()&lt;/A&gt; method. For example, expanding on the above example:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# Retrieve the group whose contents you want to list.
# (You could also search for the group by title or other properties using GroupManager's search method.)
group = gis.group.get('id_of_group')
# Compile a list of items shared with the group.
items_shared_with_group = []
# Set initial record start parameter to 0. This will be incremented for each search batch.
next_start = 0
# Loop until there are no more search results to return, as indicated by nextStart = -1.
while(next_start != -1):
    # Retrieve batch of search results
    result = group.search(
        query = "1=1",         # scopes search to examine all content
        max_items = 100,       # do not set higher than 100, or a bug will return duplicate results
        start = next_start     # start from end of last batch of search results
    )
    # If there are results returned, add them to the list of items shared with the group.
    if( 'results' in result ):
        items_shared_with_group.extend(result['results'])
    # Update the starting record for the next batch (-1 indicates no more batches to return)
    next_start = result['nextStart']
# Display count of items found shared with group
print(len(items_shared_with_group))&lt;/LI-CODE&gt;&lt;P&gt;And, if you want to generate a list of items across multiple groups, then wrap the above code block with another loop that iterates through each group, and generates an overall, aggregated list of items.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Nov 2025 15:31:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-identify-sharing-status-of-items/m-p/1662824#M11768</guid>
      <dc:creator>PeterKnoop</dc:creator>
      <dc:date>2025-11-03T15:31:52Z</dc:date>
    </item>
  </channel>
</rss>

