<?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: Automate overwrite web layer, feature class in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/m-p/1017927#M59571</link>
    <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/215649"&gt;@LeviCecil&lt;/a&gt;instead of overwriting the hosted feature service, you could run ArcGIS Pro's &lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/delete-rows.htm" target="_self"&gt;Delete Rows&lt;/A&gt; and &lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/append.htm" target="_self"&gt;Append&lt;/A&gt; tools on the feature service.&amp;nbsp; These two tools could be executed in a model, or you could &lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/analysis/geoprocessing/modelbuilder/exporting-a-model-to-python.htm" target="_self"&gt;export the model to a python script&lt;/A&gt; and run the script as a &lt;A href="https://community.esri.com/t5/python-documents/schedule-a-python-script-using-windows-task-scheduler/ta-p/915861" target="_self"&gt;scheduled task&lt;/A&gt;.&lt;/P&gt;</description>
    <pubDate>Tue, 19 Jan 2021 14:25:53 GMT</pubDate>
    <dc:creator>JakeSkinner</dc:creator>
    <dc:date>2021-01-19T14:25:53Z</dc:date>
    <item>
      <title>Automate overwrite web layer, feature class</title>
      <link>https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/m-p/20067#M1558</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;I'm trying to automate an update process for one of my hosted features in portal. So far I have:&lt;/P&gt;&lt;P&gt;1. Solved the automatic download and adjustment of the file in question. (using powershell/task scheduler)&lt;/P&gt;&lt;P&gt;2. exportet the python code that runs the "Geocode Addresses" tool on my file, saves it in a file gdb.&amp;nbsp;&lt;/P&gt;&lt;P&gt;3. manually published the feature class with the "overwrite web layer" function.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My challange is to automate step 3, and connect it to step 2.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please keep in mind that I'm completely new to scripting/python.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm currently using ArcGIS Pro 2.1.0, and have admin rights on the portal.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have looked at thise sites, and think they describe partly how to solve my issue, I'm just not able to pick out the relevant parts and build a script that works for my particular problem..&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.esri.com/thread/187019-using-python-to-overwrite-a-feature-layer"&gt;community.esri.com "using python to overwrite a feature layer"&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/python/sample-notebooks/overwriting-feature-layers/"&gt;developers.arcgis.com python, overwriting feature layers&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.esri.com/arcgis-blog/products/api-python/analytics/updating-your-hosted-feature-services-with-arcgis-pro-and-the-arcgis-api-for-python/"&gt;esri updating-your-hosted-feature-services-with-arcgis-pro-and-the-arcgis-api-for-python&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jun 2018 07:53:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/m-p/20067#M1558</guid>
      <dc:creator>EinarDørheim1</dc:creator>
      <dc:date>2018-06-14T07:53:26Z</dc:date>
    </item>
    <item>
      <title>Re: Automate overwrite web layer, feature class</title>
      <link>https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/m-p/20068#M1559</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Einar,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I recently implemented the script in your 3rd option above.&amp;nbsp; I found this easiest.&amp;nbsp; Save your layer in a Pro project and then you can run the below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; sys
&lt;SPAN class="keyword token"&gt;from&lt;/SPAN&gt; arcgis&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;gis &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; GIS

&lt;SPAN class="comment token"&gt;### Start setting variables&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;# Set the path to the project&lt;/SPAN&gt;
prjPath &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"C:\PROJECTS\NightlyUpdates\NightlyUpdates.aprx"&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# Update the following variables to match:&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;# Feature service/SD name in arcgis.com, user/password of the owner account&lt;/SPAN&gt;
sd_fs_name &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"MyPublicMap"&lt;/SPAN&gt;
portal &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"http://www.arcgis.com"&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;# Can also reference a local portal&lt;/SPAN&gt;
user &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"UserName"&lt;/SPAN&gt;
password &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"p@sswOrd"&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# Set sharing options&lt;/SPAN&gt;
shrOrg &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token boolean"&gt;True&lt;/SPAN&gt;
shrEveryone &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token boolean"&gt;False&lt;/SPAN&gt;
shrGroups &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;""&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;### End setting variables&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# Local paths to create temporary content&lt;/SPAN&gt;
relPath &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;dirname&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;prjPath&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
sddraft &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;relPath&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"WebUpdate.sddraft"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
sd &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;relPath&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"WebUpdate.sd"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# Create a new SDDraft and stage to SD&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Creating SD file"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;overwriteOutput &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token boolean"&gt;True&lt;/SPAN&gt;
prj &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mp&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ArcGISProject&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;prjPath&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
mp &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; prj&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;listMaps&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mp&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CreateWebLayerSDDraft&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;mp&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; sddraft&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; sd_fs_name&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; ‘MY_HOSTED_SERVICES’&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; ‘FEATURE_ACCESS’&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;"&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token boolean"&gt;True&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token boolean"&gt;True&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;StageService_server&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;sddraft&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; sd&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Connecting to {}"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;portal&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
gis &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; GIS&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;portal&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; user&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; password&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# Find the SD, update it, publish /w overwrite and set sharing and metadata&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Search for original SD on portal…"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
sdItem &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; gis&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;content&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;search&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"{} AND owner:{}"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;sd_fs_name&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; user&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; item_type&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Service Definition"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Found SD: {}, ID: {} n Uploading and overwriting…"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;sdItem&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;title&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; sdItem&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;id&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
sdItem&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;update&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;data&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;sd&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Overwriting existing feature service…"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
fs &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; sdItem&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;publish&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;overwrite&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token boolean"&gt;True&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; shrOrg &lt;SPAN class="operator token"&gt;or&lt;/SPAN&gt; shrEveryone &lt;SPAN class="operator token"&gt;or&lt;/SPAN&gt; shrGroups&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
  &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Setting sharing options…"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
  fs&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;share&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;org&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;shrOrg&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; everyone&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;shrEveryone&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; groups&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;shrGroups&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Finished updating: {} – ID: {}"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fs&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;title&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; fs&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;id&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;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:48:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/m-p/20068#M1559</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2021-12-10T20:48:05Z</dc:date>
    </item>
    <item>
      <title>Re: Automate overwrite web layer, feature class</title>
      <link>https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/m-p/20069#M1560</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, firstly thansk for the quick and explainatory answer. However I'm getting an error when i try to run the script, not understanding how to solve it:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any tips?&lt;/P&gt;&lt;DIV class="" style="color: #000000; background-color: #ffffff;"&gt;&lt;DIV class="" style="color: #000000; padding: 0.4em;"&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;Creating SD file




--------------------------------------------------------------------------

ExecuteError&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Traceback (most recent call last)
&amp;lt;ipython-input-3-540a66d6dc34&amp;gt; in &amp;lt;module&amp;gt;()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 32 mp = prj.listMaps()[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 33 arcpy.mp.CreateWebLayerSDDraft(mp, sddraft, sd_fs_name, 'MY_HOSTED_SERVICES', 'FEATURE_ACCESS','', True, True)
---&amp;gt; 34 arcpy.StageService_server(sddraft, sd)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 35 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 36 print("Connecting to {}".format(portal))

C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\server.py in StageService(in_service_definition_draft, out_service_definition, staging_version)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 846&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return retval
&amp;nbsp;&amp;nbsp;&amp;nbsp; 847&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; except Exception as e:
--&amp;gt; 848&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise e
&amp;nbsp;&amp;nbsp;&amp;nbsp; 849 
&amp;nbsp;&amp;nbsp;&amp;nbsp; 850 @gptooldoc('UploadServiceDefinition_server', None)

C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\server.py in StageService(in_service_definition_draft, out_service_definition, staging_version)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 843&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from arcpy.arcobjects.arcobjectconversion import convertArcObjectToPythonObject
&amp;nbsp;&amp;nbsp;&amp;nbsp; 844&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try:
--&amp;gt; 845&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; retval = convertArcObjectToPythonObject(gp.StageService_server(*gp_fixargs((in_service_definition_draft, out_service_definition, staging_version), True)))
&amp;nbsp;&amp;nbsp;&amp;nbsp; 846&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return retval
&amp;nbsp;&amp;nbsp;&amp;nbsp; 847&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; except Exception as e:

C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py in &amp;lt;lambda&amp;gt;(*args)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 504&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; val = getattr(self._gp, attr)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 505&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if callable(val):
--&amp;gt; 506&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return lambda *args: val(*gp_fixargs(args, True))
&amp;nbsp;&amp;nbsp;&amp;nbsp; 507&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp; 508&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return convertArcObjectToPythonObject(val)

ExecuteError: ERROR 999999: Error executing function.
Failed to execute (StageService).

&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:48:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/m-p/20069#M1560</guid>
      <dc:creator>EinarDørheim1</dc:creator>
      <dc:date>2021-12-10T20:48:08Z</dc:date>
    </item>
    <item>
      <title>Re: Automate overwrite web layer, feature class</title>
      <link>https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/m-p/20070#M1561</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Looks like it's erroring when trying to create the SD file.&amp;nbsp; Double-check to make sure you have the correct path to your aprx file.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Jun 2018 16:56:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/m-p/20070#M1561</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2018-06-15T16:56:32Z</dc:date>
    </item>
    <item>
      <title>Re: Automate overwrite web layer, feature class</title>
      <link>https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/m-p/20071#M1562</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;figured it out, the problem was with:&lt;/P&gt;&lt;PRE class="" style="color: #000000; background: #f5f2f0; border: 0px; font-size: 14px; margin: 0.5em 0px; padding: 1em 1em 1em 3.8em;"&gt;&lt;CODE style="border: 0px; font-weight: inherit; font-size: 14px;"&gt;relPath &lt;SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.5); border: 0px; font-weight: inherit; font-size: 14px;"&gt;=&lt;/SPAN&gt; sys&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit; font-size: 14px;"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit; font-size: 14px;"&gt;[&lt;/SPAN&gt;&lt;SPAN class="" style="color: #990000; border: 0px; font-weight: inherit; font-size: 14px;"&gt;0&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit; font-size: 14px;"&gt;]&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Changed sys.path[0] to an absolute path and it worked like a charm!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jun 2018 06:15:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/m-p/20071#M1562</guid>
      <dc:creator>EinarDørheim1</dc:creator>
      <dc:date>2018-06-20T06:15:51Z</dc:date>
    </item>
    <item>
      <title>Re: Automate overwrite web layer, feature class</title>
      <link>https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/m-p/20072#M1563</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, I am getting a different error when I run it in the Python Window in ArcGIS Pro:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;### End setting variables&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;# Local paths to create temporary content&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12px;"&gt;relPath = sys.path[0]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12px;"&gt;sddraft = os.path.join(relPath, "CitizenConcerns_all.sddraft")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12px;"&gt;sd = os.path.join(relPath, "CitizenConcerns_all.sd")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;# Create a new SDDraft and stage to SD&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12px;"&gt;print("Creating SD file")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12px;"&gt;arcpy.env.overwriteOutput = True&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12px;"&gt;prj = arcpy.mp.ArcGISProject(prjPath)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12px;"&gt;mp = prj.listMaps()[0]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12px; color: #0000ff;"&gt;arcpy.mp.CreateWebLayerSDDraft(mp, sddraft, sd_fs_name, 'MY_HOSTED_SERVICES', 'FEATURE_ACCESS','', True, True)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12px;"&gt;arcpy.StageService_server(sddraft, sd)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;print("Connecting to {}".format(portal))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12px;"&gt;gis = GIS(portal, user, password)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;# Find the SD, update it, publish /w overwrite and set sharing and metadata&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12px;"&gt;print("Search for original SD on portal…")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12px;"&gt;sdItem = gis.content.search("{} AND owner:{}".format(sd_fs_name, user), item_type="Service Definition")[0]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12px;"&gt;print("Found SD: {}, ID: {} n Uploading and overwriting…".format(sdItem.title, sdItem.id))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12px;"&gt;sdItem.update(data=sd)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12px;"&gt;print("Overwriting existing feature service…")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12px;"&gt;fs = sdItem.publish(overwrite=True)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;if shrOrg or shrEveryone or shrGroups:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12px;"&gt; print("Setting sharing options…")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12px;"&gt; fs.share(org=shrOrg, everyone=shrEveryone, groups=shrGroups)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;print("Finished updating: {} – ID: {}".format(fs.title, fs.id))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12px;"&gt;Creating SD file&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff0000; font-size: 12px;"&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff0000; font-size: 12px;"&gt; File "&amp;lt;string&amp;gt;", line 33, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff0000; font-size: 12px;"&gt; File "c:\program files\arcgis pro\Resources\arcpy\arcpy\mp.py", line 105, in CreateWebLayerSDDraft&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff0000; font-size: 12px;"&gt; return _convertArcObjectToPythonObject(arcgisscripting._mapping.CreateWebLayerSDDraft(*_gp_fixargs([map_or_layers, out_sddraft, service_name, server_type, service_type, folder_name, overwrite_existing_service, copy_data_to_server, enable_editing, allow_exporting, enable_sync, summary, tags, description, credits, use_limitations], True)))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff0000; font-size: 12px;"&gt;RuntimeError&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Oct 2018 17:50:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/m-p/20072#M1563</guid>
      <dc:creator>BenBaker1</dc:creator>
      <dc:date>2018-10-23T17:50:33Z</dc:date>
    </item>
    <item>
      <title>Re: Automate overwrite web layer, feature class</title>
      <link>https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/m-p/20073#M1564</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN&gt;I am using Windows Authentication for the Portal. And it gives the "&lt;/SPAN&gt;&lt;SPAN&gt;&lt;EM&gt;IndexError: list index out of range&lt;/EM&gt;" error message when it reaches the line&amp;nbsp;&lt;STRONG&gt;sdItem = gis.content.search("{} AND owner:{}".format(sd_fs_name, user), item_type="Service Definition")[0].&amp;nbsp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here are my 4 lines for connecting to the Portal in the beginning of the script.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;sd_fs_name = "&amp;lt;feature layer name&amp;gt;"&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;portal = "&amp;lt;Portal URL&amp;gt;"&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;user = ""&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;password = ""&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help will be greatly appreciated!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Jun 2019 19:09:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/m-p/20073#M1564</guid>
      <dc:creator>WaiChan</dc:creator>
      <dc:date>2019-06-05T19:09:52Z</dc:date>
    </item>
    <item>
      <title>Re: Automate overwrite web layer, feature class</title>
      <link>https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/m-p/20074#M1565</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Never mind. User error. It would help to have the feature layer already hosted in the Portal. Once the feature layer exists in Portal, the script overwrote the hosted feature layer successfully.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Jun 2019 15:17:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/m-p/20074#M1565</guid>
      <dc:creator>WaiChan</dc:creator>
      <dc:date>2019-06-06T15:17:46Z</dc:date>
    </item>
    <item>
      <title>Re: Automate overwrite web layer, feature class</title>
      <link>https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/m-p/20075#M1566</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am having the same error appear for me when running the script in Python from ArcGIS Pro. Did you get a solution as to why the error was coming and if so what was it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be appreciated&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Nov 2019 23:05:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/m-p/20075#M1566</guid>
      <dc:creator>Tweed_ShireAdmin</dc:creator>
      <dc:date>2019-11-11T23:05:22Z</dc:date>
    </item>
    <item>
      <title>Re: Automate overwrite web layer, feature class</title>
      <link>https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/m-p/20076#M1567</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/152670"&gt;Tweed Shire Admin&lt;/A&gt;‌ can you post the code you are executing?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Nov 2019 13:55:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/m-p/20076#M1567</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2019-11-14T13:55:04Z</dc:date>
    </item>
    <item>
      <title>Re: Automate overwrite web layer, feature class</title>
      <link>https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/m-p/20077#M1568</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jake, I'm currently working with&amp;nbsp;&lt;A _jive_internal="true" data-containerid="-1" data-containertype="-1" data-objectid="152670" data-objecttype="3" href="https://community.esri.com/people/gis_tweed"&gt;Tweed Shire Admin&lt;/A&gt;&amp;nbsp;to try and resolve this issue.&lt;/P&gt;&lt;P&gt;Code is as follows:&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/475343_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #080707; background-color: #ffffff;"&gt;- User is unable to run a python script that overwrites a feature layer in ArcGIS Online&lt;/SPAN&gt;&lt;BR style="color: #080707; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #080707; background-color: #ffffff;"&gt;- Script is fine, and I can run her script (even with her credentials included) from my ArcGIS Pro&lt;/SPAN&gt;&lt;BR style="color: #080707; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #080707; background-color: #ffffff;"&gt;- Issue is not specific to her machine&lt;/SPAN&gt;&lt;BR style="color: #080707; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #080707; background-color: #ffffff;"&gt;- Complete uninstall and reinstall did not resolve the issue.&lt;/SPAN&gt;&lt;BR style="color: #080707; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #080707; background-color: #ffffff;"&gt;- Error message cites Runtime error&lt;/SPAN&gt;&lt;BR style="color: #080707; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #080707; background-color: #ffffff;"&gt;- Script tested same problems in Python window of ArcGIS Pro and IDLE&lt;/SPAN&gt;&lt;BR style="color: #080707; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #080707; background-color: #ffffff;"&gt;- Replicated on another machine within the network&lt;/SPAN&gt;&lt;BR style="color: #080707; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #080707; background-color: #ffffff;"&gt;- Replicated on a laptop outside of the network&lt;/SPAN&gt;&lt;BR style="color: #080707; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #080707; background-color: #ffffff;"&gt;- Comprehensive uninstall and reinstallation had no effect&lt;/SPAN&gt;&lt;BR style="color: #080707; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #080707; background-color: #ffffff;"&gt;- Client cannot manually overwrite the feature service from Pro either&lt;/SPAN&gt;&lt;BR style="color: #080707; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #080707; background-color: #ffffff;"&gt;- Systems check revealed machine environment is fine for Pro&lt;/SPAN&gt;&lt;BR style="color: #080707; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #080707; background-color: #ffffff;"&gt;- There are no other feature services published from the same data&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #080707; background-color: #ffffff;"&gt;Same error received as&amp;nbsp;&lt;A href="https://community.esri.com/people/bbaker_mhgis"&gt;bbaker_mhgis&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Dec 2019 02:49:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/m-p/20077#M1568</guid>
      <dc:creator>GlenShepherd</dc:creator>
      <dc:date>2019-12-05T02:49:54Z</dc:date>
    </item>
    <item>
      <title>Re: Automate overwrite web layer, feature class</title>
      <link>https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/m-p/20078#M1569</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Glen&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="background-color: #ffffff; color: #080707; "&gt;Client cannot manually overwrite the feature service from Pro either&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;If ArcGIS Pro is not working correctly, the code will most likely not work.&amp;nbsp; I would focus on getting Pro working, then circle back to the code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Dec 2019 21:07:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/m-p/20078#M1569</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2019-12-05T21:07:22Z</dc:date>
    </item>
    <item>
      <title>Re: Automate overwrite web layer, feature class</title>
      <link>https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/m-p/20079#M1570</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, I am also receiving the same error. I am not having any issues with Pro however, and can manually update from there just fine. I am currently working out of jupyter notebook if that helps at all.&lt;IMG alt="" class="jive-emoji image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/477403_error123.PNG" /&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Jan 2020 16:45:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/m-p/20079#M1570</guid>
      <dc:creator>PatFelser</dc:creator>
      <dc:date>2020-01-06T16:45:18Z</dc:date>
    </item>
    <item>
      <title>Re: Automate overwrite web layer, feature class</title>
      <link>https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/m-p/20080#M1571</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Jake,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your script is awesome and I have successfully used it to updated a feature layer on my AGOL organization account.&amp;nbsp; The only issue I am facing now is to be able to preserve the "allow export data" option.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Amanda&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Feb 2020 15:43:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/m-p/20080#M1571</guid>
      <dc:creator>AmandaBishop2018</dc:creator>
      <dc:date>2020-02-06T15:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: Automate overwrite web layer, feature class</title>
      <link>https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/m-p/20081#M1572</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Amanda,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try updating the following line to include the &lt;STRONG&gt;allow_exporting&lt;/STRONG&gt; parameter:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mp&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CreateWebLayerSDDraft&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;mp&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; sddraft&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; sd_fs_name&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; ‘MY_HOSTED_SERVICES’&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; ‘FEATURE_ACCESS’&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;"&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token boolean"&gt;True&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token boolean"&gt;True&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; allow_exporting&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token boolean"&gt;True&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Feb 2020 16:01:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/m-p/20081#M1572</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2020-02-06T16:01:57Z</dc:date>
    </item>
    <item>
      <title>Re: Automate overwrite web layer, feature class</title>
      <link>https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/m-p/20082#M1573</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Worked perfectly!&amp;nbsp; Another questions... since I'm fairly new to automating this task... How would I preserve the thumbnail pic?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Feb 2020 16:10:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/m-p/20082#M1573</guid>
      <dc:creator>AmandaBishop2018</dc:creator>
      <dc:date>2020-02-06T16:10:54Z</dc:date>
    </item>
    <item>
      <title>Re: Automate overwrite web layer, feature class</title>
      <link>https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/m-p/20083#M1574</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;And also... with the allow export option.. it seems to allow the export but not to a fgdb format?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Feb 2020 16:13:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/m-p/20083#M1574</guid>
      <dc:creator>AmandaBishop2018</dc:creator>
      <dc:date>2020-02-06T16:13:20Z</dc:date>
    </item>
    <item>
      <title>Re: Automate overwrite web layer, feature class</title>
      <link>https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/m-p/20084#M1575</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried this update script to another copy of our parcel feature service called "TaxParcels".&amp;nbsp; I recieved an error this time.&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/480604_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Feb 2020 17:17:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/m-p/20084#M1575</guid>
      <dc:creator>AmandaBishop2018</dc:creator>
      <dc:date>2020-02-07T17:17:50Z</dc:date>
    </item>
    <item>
      <title>Re: Automate overwrite web layer, feature class</title>
      <link>https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/m-p/20085#M1576</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Glen,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;I am receiving the same runtime error above. I have tried all of the items you mentioned. Were you able to resolve this issue?&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Ben&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Feb 2020 19:10:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/m-p/20085#M1576</guid>
      <dc:creator>BenYeager</dc:creator>
      <dc:date>2020-02-11T19:10:33Z</dc:date>
    </item>
    <item>
      <title>Re: Automate overwrite web layer, feature class</title>
      <link>https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/m-p/20086#M1577</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ben, yes I was able to figure out the issue.&lt;/P&gt;&lt;P&gt;sys.path[0] is a Python executable that refers to the directory of the script being run. Seeing as we were copying the script into the Python window, it doesn't have a saved directory, so we needed to give it one. i.e. r"D:\BigFolder\LittleFolder"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;This is the script I used, modified from the original one in this thread:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="ShereePythonExample2" height="605" src="https://esri--c.na53.content.force.com/sfc/servlet.shepherd/version/download/068f2000009PObL?asPdf=false&amp;amp;operationContext=CHATTER" width="731" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's the text if you'd like to copy it. Obviously you'll need to update all of your own parameters:&lt;/P&gt;&lt;P&gt;--------------------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;import arcpy&lt;BR /&gt;import os, sys&lt;BR /&gt;from arcgis.gis import GIS&lt;/P&gt;&lt;P&gt;# Start setting variables&lt;BR /&gt;# Set the path to the project&lt;BR /&gt;prjPath = r"D:\Sample Data\SampleWorking\SampleWorking.aprx"&lt;/P&gt;&lt;P&gt;# Update the following variables to match&lt;BR /&gt;sd_fs_name = "ShereeTest"&lt;BR /&gt;portal = "https://www.arcgis.com/"&lt;BR /&gt;user = "enter_username"&lt;BR /&gt;password = "enter_password"&lt;/P&gt;&lt;P&gt;# Set sharing options&lt;BR /&gt;shrOrg = True&lt;BR /&gt;shrEveryone = True&lt;BR /&gt;shrGroups = ""&lt;/P&gt;&lt;P&gt;# End setting variables&lt;/P&gt;&lt;P&gt;# Local paths to create temporary content&lt;BR /&gt;relPath = r"C:\GIVE_A_FILE_DIRECTORY"&lt;BR /&gt;sddraft = os.path.join(relPath, "WebUpdate.sddraft")&lt;BR /&gt;sd = os.path.join(relPath, "WebUpdate.sd")&lt;/P&gt;&lt;P&gt;#Create a new sddraft and stage to sd&lt;BR /&gt;print("Creating SD file...")&lt;BR /&gt;arcpy.env.overwriteOutput = True&lt;BR /&gt;prj = arcpy.mp.ArcGISProject(prjPath)&lt;BR /&gt;mp = prj.listMaps()[0]&lt;/P&gt;&lt;P&gt;arcpy.mp.CreateWebLayerSDDraft(map_or_layers=mp,&lt;BR /&gt; out_sddraft=sddraft,&lt;BR /&gt; service_name=sd_fs_name,&lt;BR /&gt; server_type="HOSTING_SERVER",&lt;BR /&gt; service_type="FEATURE_ACCESS",&lt;BR /&gt; folder_name=None,&lt;BR /&gt; overwrite_existing_service=True,&lt;BR /&gt; copy_data_to_server=True)&lt;/P&gt;&lt;P&gt;arcpy.StageService_server(in_service_definition_draft=sddraft,&lt;BR /&gt; out_service_definition=sd)&lt;/P&gt;&lt;P&gt;print("Connecting to {}".format(portal))&lt;BR /&gt;gis = GIS(portal, user, password)&lt;/P&gt;&lt;P&gt;# Find the sd, update it, publish it with overwrite and set sharing and metadata&lt;BR /&gt;print("Search for original SD on portal...")&lt;BR /&gt;sdItem = gis.content.search("{} AND owner:{}".format(sd_fs_name, user), item_type="Service Definition")[0]&lt;BR /&gt;print("Found SD: {}, ID: {} n Uploading and Overwriting...".format(sdItem.title, sdItem.id))&lt;BR /&gt;sdItem.update(data=sd)&lt;BR /&gt;print("Overwriting existing feature service...")&lt;BR /&gt;fs = sdItem.publish(overwrite=True)&lt;/P&gt;&lt;P&gt;if shrOrg or sheEveryone or sheGroups:&lt;BR /&gt; print("Setting sharing options...")&lt;BR /&gt; fs.share(org=shrOrg, everyone=shrEveryone, groups=shrGroups)&lt;/P&gt;&lt;P&gt;print("Finished updateing: {} - ID: {}".format(fs.title, fs.id))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Feb 2020 20:57:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/automate-overwrite-web-layer-feature-class/m-p/20086#M1577</guid>
      <dc:creator>GlenShepherd</dc:creator>
      <dc:date>2020-02-11T20:57:49Z</dc:date>
    </item>
  </channel>
</rss>

