<?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 ArcGIS Api for Python - set content status on Item in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-api-for-python-set-content-status-on-item/m-p/824775#M2961</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello - does anyone know how to set the content status on an item?&amp;nbsp; Currently, the api will allow you to read the content status property, but there seems to be no way to set the content status.&amp;nbsp; Something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;portItem&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;update&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;item_properties&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'content_status'&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'org_authoritative'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;would be ideal but 'content_status is not a property that can be set as part of item_properties, even as the json return does show content_status as contentStatus.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 17 Dec 2019 18:48:41 GMT</pubDate>
    <dc:creator>DavidColey</dc:creator>
    <dc:date>2019-12-17T18:48:41Z</dc:date>
    <item>
      <title>ArcGIS Api for Python - set content status on Item</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-api-for-python-set-content-status-on-item/m-p/824775#M2961</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello - does anyone know how to set the content status on an item?&amp;nbsp; Currently, the api will allow you to read the content status property, but there seems to be no way to set the content status.&amp;nbsp; Something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;portItem&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;update&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;item_properties&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'content_status'&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'org_authoritative'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;would be ideal but 'content_status is not a property that can be set as part of item_properties, even as the json return does show content_status as contentStatus.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Dec 2019 18:48:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-api-for-python-set-content-status-on-item/m-p/824775#M2961</guid>
      <dc:creator>DavidColey</dc:creator>
      <dc:date>2019-12-17T18:48:41Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Api for Python - set content status on Item</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-api-for-python-set-content-status-on-item/m-p/824776#M2962</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All you have to do is the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;portItem&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;content_status &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'authoritative'&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jan 2020 21:07:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-api-for-python-set-content-status-on-item/m-p/824776#M2962</guid>
      <dc:creator>LorneDmitruk2</dc:creator>
      <dc:date>2020-01-13T21:07:57Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Api for Python - set content status on Item</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-api-for-python-set-content-status-on-item/m-p/824777#M2963</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Lorne, yes that did it.&amp;nbsp; 'org_authoritative' for portal.&amp;nbsp; I thought I tried that first thing, but sadly the api documentation isn't as intuitive as maybe it should be.&amp;nbsp; If interested, you can follow the content_status property setting with an Item.protect(enable=False) to remove delete protection, as I've been tripped up many times by having a layer set with delete protection . . .&lt;/P&gt;&lt;P&gt;&lt;CODE style="border: 0px; font-weight: inherit; font-size: 14px;"&gt;&lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit; font-size: 14px;"&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jan 2020 17:26:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-api-for-python-set-content-status-on-item/m-p/824777#M2963</guid>
      <dc:creator>DavidColey</dc:creator>
      <dc:date>2020-01-14T17:26:39Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Api for Python - set content status on Item</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-api-for-python-set-content-status-on-item/m-p/1580559#M11109</link>
      <description>&lt;P&gt;&amp;nbsp;found this &lt;A href="https://learn.finaldraftmapping.com/adding-delete-protection-for-arcgis-online-content-items-with-the-arcgis-api-for-python/" target="_self"&gt;super helpful article&lt;/A&gt; today by one of our Esri Community's newest MVPs,&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/417766"&gt;@Clubdebambos&lt;/a&gt;&amp;nbsp;!&lt;/P&gt;&lt;P&gt;from the Esri docs:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A href="https://developers.arcgis.com/python/latest/api-reference/arcgis.gis.toc.html#arcgis.gis.Item.content_status" target="_self"&gt;content_status property&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://developers.arcgis.com/python/latest/api-reference/arcgis.gis.toc.html#arcgis.gis.Group.protected" target="_self"&gt;protect method&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jan 2025 19:28:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-api-for-python-set-content-status-on-item/m-p/1580559#M11109</guid>
      <dc:creator>ToddW_stl</dc:creator>
      <dc:date>2025-01-30T19:28:03Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Api for Python - set content status on Item</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-api-for-python-set-content-status-on-item/m-p/1581005#M11113</link>
      <description>&lt;P&gt;Yes, I've been doing this for about 5 years now:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;gis = GIS("https://yourorg.maps.arcgis.com/", "username", "pw")
try:
    pubGroups = gis.groups.search(query='title:Some Group Title', max_groups=1000)
    for pubGroup in pubGroups:
        #print (pubGroup.title)
        if (pubGroup.title == 'Some Group Title Layers Group'): 
            print (pubGroup.title)
            items = pubGroup.content()
            #print (items)
            for item in items:
                #print(item.name)
                item.content_status = 'authoritative'
                item.protect(enable=False)
                #print(item.content_status)          
        
            message = message + "\n" + (pubGroup.title) + " Itens Sucessfully Reauthorized"

except Exception:
    # If an error occurred, print line number and error message
    import traceback, sys
    tb = sys.exc_info()[2]
    e = sys.exc_info()[1]
    print(e.args[0])
    print ("Line %i" % tb.tb_lineno)
    message = message + "\n" + "Line %i" % tb.tb_lineno
    message = message + "\n" + str(e&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this way, you can just loop through your groups and the items in each group and set its content status and its protect status.&amp;nbsp; I do this because each week as my collaborated layers sync by reference from portal to arcgis online, I need to re-authorize the layers.&lt;/P&gt;&lt;P&gt;More importantly though, for the layers in the workspace collaborations to sync without fail I need to remove the delete protect status....&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jan 2025 20:36:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-api-for-python-set-content-status-on-item/m-p/1581005#M11113</guid>
      <dc:creator>DavidColey</dc:creator>
      <dc:date>2025-01-31T20:36:15Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Api for Python - set content status on Item</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-api-for-python-set-content-status-on-item/m-p/1581008#M11114</link>
      <description>&lt;P&gt;awesome, nice work.&amp;nbsp; thanks for marking a solution!&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jan 2025 20:42:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-api-for-python-set-content-status-on-item/m-p/1581008#M11114</guid>
      <dc:creator>ToddW_stl</dc:creator>
      <dc:date>2025-01-31T20:42:58Z</dc:date>
    </item>
  </channel>
</rss>

