<?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 Overwriting a feature layer on AGOL using a feature class in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/overwriting-a-feature-layer-on-agol-using-a/m-p/1307471#M8864</link>
    <description>&lt;P&gt;I am writing a script that will overwrite a feature layer on AGOL from a feature class I manage in a GDB - the issue I'm having is the .overwrite path&lt;/P&gt;&lt;P&gt;This is the script I have currently have is below. I successfully connect to AGOL and access the selected feature layer - but the script fails on line 21. The error is below.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
from arcgis import GIS
from arcgis.features import FeatureLayerCollection
import os

# AGOL Details
username = 'myaccount'
password = 'password'
gis = GIS("https://www.arcgis.com", username, password)

# Item ID for feature to overwrite
itemid = '44ace4fd9e764c36bac2b9056679faee'

# Details for fc
GDB = r'H:\Projects\AGOL Overwrite Features\AGOL Overwrite Features.gdb'
newname = os.path.join(GDB, 'Test_Points_Overwrite')

# Overwrite feature layer
dataitem = gis.content.get(itemid)
flayercol = FeatureLayerCollection.fromitem(dataitem)
flayercol.manager.overwrite(newname) &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;  File "H:\Projects\AGOL Overwrite Features\overwrite.py", line 50, in &amp;lt;module&amp;gt;
    flayercol.manager.overwrite(newname)
  File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\features\managers.py", line 2271, in overwrite
    publish_parameters, overwrite=True
  File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\gis\__init__.py", line 12743, in publish
    serviceitem_id = self._check_publish_status(ret, folder)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Instead of the variable 'newname' I've also tried fc = r'path to feature class in GDB' which got the same error.&lt;/P&gt;&lt;P&gt;Any help would be much appreciated &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 11 Jul 2023 23:49:58 GMT</pubDate>
    <dc:creator>MichaelFowler1</dc:creator>
    <dc:date>2023-07-11T23:49:58Z</dc:date>
    <item>
      <title>Overwriting a feature layer on AGOL using a feature class</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/overwriting-a-feature-layer-on-agol-using-a/m-p/1307471#M8864</link>
      <description>&lt;P&gt;I am writing a script that will overwrite a feature layer on AGOL from a feature class I manage in a GDB - the issue I'm having is the .overwrite path&lt;/P&gt;&lt;P&gt;This is the script I have currently have is below. I successfully connect to AGOL and access the selected feature layer - but the script fails on line 21. The error is below.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
from arcgis import GIS
from arcgis.features import FeatureLayerCollection
import os

# AGOL Details
username = 'myaccount'
password = 'password'
gis = GIS("https://www.arcgis.com", username, password)

# Item ID for feature to overwrite
itemid = '44ace4fd9e764c36bac2b9056679faee'

# Details for fc
GDB = r'H:\Projects\AGOL Overwrite Features\AGOL Overwrite Features.gdb'
newname = os.path.join(GDB, 'Test_Points_Overwrite')

# Overwrite feature layer
dataitem = gis.content.get(itemid)
flayercol = FeatureLayerCollection.fromitem(dataitem)
flayercol.manager.overwrite(newname) &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;  File "H:\Projects\AGOL Overwrite Features\overwrite.py", line 50, in &amp;lt;module&amp;gt;
    flayercol.manager.overwrite(newname)
  File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\features\managers.py", line 2271, in overwrite
    publish_parameters, overwrite=True
  File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\gis\__init__.py", line 12743, in publish
    serviceitem_id = self._check_publish_status(ret, folder)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Instead of the variable 'newname' I've also tried fc = r'path to feature class in GDB' which got the same error.&lt;/P&gt;&lt;P&gt;Any help would be much appreciated &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2023 23:49:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/overwriting-a-feature-layer-on-agol-using-a/m-p/1307471#M8864</guid>
      <dc:creator>MichaelFowler1</dc:creator>
      <dc:date>2023-07-11T23:49:58Z</dc:date>
    </item>
    <item>
      <title>Re: Overwriting a feature layer on AGOL using a feature class</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/overwriting-a-feature-layer-on-agol-using-a/m-p/1307476#M8865</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/49147"&gt;@MichaelFowler1&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Although you may have already seen the link, I'll share it here anyway. A few things to check out that may help. I've copied these steps from the overwrite ArcGIS API for Python&amp;nbsp;&lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.features.managers.html#arcgis.features.managers.FeatureLayerCollectionManager.overwrite" target="_self"&gt;here&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;OL class=""&gt;&lt;LI&gt;&lt;P&gt;&lt;EM&gt;Only hosted feature layer collection services can be overwritten&lt;/EM&gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;EM&gt;The original data used to publish this layer should be available on the portal&lt;/EM&gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;EM&gt;The data file used to overwrite should be of the same format and filename as the original that was used to publish the layer&lt;/EM&gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;EM&gt;The schema (column names, column data types) of the data_file should be the same as original. You can have additional or fewer rows (features).&lt;/EM&gt;&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;These may get you out of trouble. Specifically if you look into step 3 and 4.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2023 01:07:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/overwriting-a-feature-layer-on-agol-using-a/m-p/1307476#M8865</guid>
      <dc:creator>alex_mapintel</dc:creator>
      <dc:date>2023-07-12T01:07:50Z</dc:date>
    </item>
    <item>
      <title>Re: Overwriting a feature layer on AGOL using a feature class</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/overwriting-a-feature-layer-on-agol-using-a/m-p/1307807#M8871</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/674562"&gt;@alex_mapintel&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for sending that through!&lt;/P&gt;&lt;P&gt;I believe I'm good on Step 1, 2 and 4 - with step three I've gone back to 'fc = r'file path to original feature class' and now the script completes every time it is run. The issue now is it doesn't actually update/overwrite the feature layer with the new data and I've noticed that if I add or delete points from AGOL when I run the script it will revert back to the original dataset (even when the original dataset has changed). Do you happen to know why this occurs?&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2023 01:26:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/overwriting-a-feature-layer-on-agol-using-a/m-p/1307807#M8871</guid>
      <dc:creator>MichaelFowler1</dc:creator>
      <dc:date>2023-07-13T01:26:33Z</dc:date>
    </item>
    <item>
      <title>Re: Overwriting a feature layer on AGOL using a feature class</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/overwriting-a-feature-layer-on-agol-using-a/m-p/1308488#M8875</link>
      <description>&lt;P&gt;The solution has been found!&lt;/P&gt;&lt;P&gt;For anyone else needing the solution - it was found here&amp;nbsp;&lt;A href="https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/td-p/20067" target="_blank"&gt;Automate overwrite web layer, feature class - Esri Community&lt;/A&gt;&amp;nbsp;The answer by Jake Skinner worked wonders - I did have to change one line but that was in the comments with many other troubleshooting answers&lt;/P&gt;</description>
      <pubDate>Sun, 16 Jul 2023 23:00:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/overwriting-a-feature-layer-on-agol-using-a/m-p/1308488#M8875</guid>
      <dc:creator>MichaelFowler1</dc:creator>
      <dc:date>2023-07-16T23:00:10Z</dc:date>
    </item>
    <item>
      <title>Re: Overwriting a feature layer on AGOL using a feature class</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/overwriting-a-feature-layer-on-agol-using-a/m-p/1595910#M11224</link>
      <description>&lt;P&gt;I went about things similar to your posted code but am having trouble parsing through and converting to the code Jake Skinner posted.&amp;nbsp; Could you share your modified script so I can try to map the changes?&amp;nbsp; Thanks&lt;/P&gt;</description>
      <pubDate>Sun, 16 Mar 2025 21:59:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/overwriting-a-feature-layer-on-agol-using-a/m-p/1595910#M11224</guid>
      <dc:creator>ClintBoaz1</dc:creator>
      <dc:date>2025-03-16T21:59:30Z</dc:date>
    </item>
  </channel>
</rss>

