<?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 Enable Attachments in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/enable-attachments/m-p/860180#M4154</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there any way to enable attachments on an existing hosted feature service with the API?&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 06 Jul 2018 23:36:40 GMT</pubDate>
    <dc:creator>PatrickFilyer</dc:creator>
    <dc:date>2018-07-06T23:36:40Z</dc:date>
    <item>
      <title>Enable Attachments</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/enable-attachments/m-p/860180#M4154</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there any way to enable attachments on an existing hosted feature service with the API?&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jul 2018 23:36:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/enable-attachments/m-p/860180#M4154</guid>
      <dc:creator>PatrickFilyer</dc:creator>
      <dc:date>2018-07-06T23:36:40Z</dc:date>
    </item>
    <item>
      <title>Re: Enable Attachments</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/enable-attachments/m-p/860181#M4155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Patrick,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using the code below I was able to turn on and off attachments to the featurelayer.&lt;/P&gt;&lt;P&gt;The code is straightforward, it searches for and finds the layer you want to change.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Change the username and password&lt;/LI&gt;&lt;LI&gt;My FeatureService only had 1 featurelayer in it. so on this line of code was used to access the featurelayer, If you had more FeatureLayers to add attachment capability to you could loop on them.&lt;/LI&gt;&lt;/OL&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;featLyr = featCollection.layers[&lt;SPAN style="color: #0000ff;"&gt;0&lt;/SPAN&gt;]

Code:&lt;/PRE&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;from &lt;/SPAN&gt;arcgis.gis &lt;SPAN style="color: #000080; font-weight: bold;"&gt;import &lt;/SPAN&gt;GIS

gis = GIS(&lt;SPAN style="color: #008080; font-weight: bold;"&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fwww.arcgis.com" target="_blank"&gt;https://www.arcgis.com&lt;/A&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt;, &lt;SPAN style="color: #008080; font-weight: bold;"&gt;"&amp;lt;USERNAME&amp;gt;"&lt;/SPAN&gt;, &lt;SPAN style="color: #008080; font-weight: bold;"&gt;"&amp;lt;PASSWORD"&lt;/SPAN&gt;)

srcResults = gis.content.search(&lt;SPAN style="color: #008080; font-weight: bold;"&gt;"title:ServiceAreas"&lt;/SPAN&gt;,&lt;SPAN style="color: #660099;"&gt;item_type &lt;/SPAN&gt;= &lt;SPAN style="color: #008080; font-weight: bold;"&gt;"Feature Layer"&lt;/SPAN&gt;)
featCollection = srcResults[&lt;SPAN style="color: #0000ff;"&gt;0&lt;/SPAN&gt;]
featLyr = featCollection.layers[&lt;SPAN style="color: #0000ff;"&gt;0&lt;/SPAN&gt;]

&lt;SPAN style="color: #808080;"&gt;#Get the manager associated with the featurelayer to update
&lt;/SPAN&gt;mgr = featLyr.manager

&lt;SPAN style="color: #808080;"&gt;#Update the featurelayer definition to allow attachments
&lt;/SPAN&gt;mgr.update_definition({&lt;SPAN style="color: #008080; font-weight: bold;"&gt;"hasAttachments"&lt;/SPAN&gt;: &lt;SPAN style="color: #000080; font-weight: bold;"&gt;False&lt;/SPAN&gt;})&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know if you have any questions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jeff&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 10:39:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/enable-attachments/m-p/860181#M4155</guid>
      <dc:creator>JeffBigos</dc:creator>
      <dc:date>2021-12-12T10:39:37Z</dc:date>
    </item>
    <item>
      <title>Re: Enable Attachments</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/enable-attachments/m-p/860182#M4156</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Jeff. This works.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Jul 2018 16:29:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/enable-attachments/m-p/860182#M4156</guid>
      <dc:creator>PatrickFilyer</dc:creator>
      <dc:date>2018-07-16T16:29:58Z</dc:date>
    </item>
  </channel>
</rss>

