<?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: Add new tag without removing existing ones in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/add-new-tag-without-removing-existing-ones/m-p/1218207#M7834</link>
    <description>&lt;P&gt;Although item.tags returns a list, using the append method directly on the property returns None.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis import GIS

agol = GIS("home")

item = agol.content.get("item_id")

tags_1 = item.tags

print(tags_1)
&amp;gt;&amp;gt;&amp;gt; ['tag1', 'tag2', 'tag3']

tags_2 = item.tags.append("newtag")

print(tags_2)
&amp;gt;&amp;gt;&amp;gt; None

## USE THIS
tags = item.tags

tags.append("newtag")

item.update(item_properties={'tags':tags})
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 03 Oct 2022 10:19:51 GMT</pubDate>
    <dc:creator>Clubdebambos</dc:creator>
    <dc:date>2022-10-03T10:19:51Z</dc:date>
    <item>
      <title>Add new tag without removing existing ones</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/add-new-tag-without-removing-existing-ones/m-p/1218018#M7830</link>
      <description>&lt;P&gt;Im trying to do what i thought would be a simple task but its turning out not to be so simple (or maybe it is but im making it not simple).&amp;nbsp; I just want to add a new tag to all my items in my portal without removing their existing tags.&amp;nbsp; I have attempted to use item.update but that removes existing tags.&amp;nbsp; I have moved on to getting the existing list of tags from item.tags and then appending to that list but i cannot get the code to work (spoiler alert, i am not a python expert).&amp;nbsp; I've tried inserting as a list as well as converting to a string to insert into the update function.&amp;nbsp; nothing seems to work.&amp;nbsp; Any help is appreciated.&lt;/P&gt;&lt;P&gt;this is latest iteration:&lt;/P&gt;&lt;PRE&gt;item = source.content.get(&lt;SPAN&gt;"item_id"&lt;/SPAN&gt;)&lt;BR /&gt;tags = item.tags&lt;BR /&gt;tags.append(&lt;SPAN&gt;'newtag'&lt;/SPAN&gt;)&lt;BR /&gt;liststring = &lt;SPAN&gt;','&lt;/SPAN&gt;.join(tags)&lt;BR /&gt;inputstring = &lt;SPAN&gt;"item_properties={'tags': '" &lt;/SPAN&gt;+ liststring + &lt;SPAN&gt;"'}"&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;item.update(inputstring)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;thanks&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2022 20:29:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/add-new-tag-without-removing-existing-ones/m-p/1218018#M7830</guid>
      <dc:creator>Rayn</dc:creator>
      <dc:date>2022-09-30T20:29:08Z</dc:date>
    </item>
    <item>
      <title>Re: Add new tag without removing existing ones</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/add-new-tag-without-removing-existing-ones/m-p/1218127#M7833</link>
      <description>&lt;P&gt;You may be making it more complicated than you need to. According to the docs, the &lt;STRONG&gt;tags&lt;/STRONG&gt; object is:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;Optional string. Tags listed as comma-separated values, or a list of strings. Used for searches on items.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Also, I don't think it will work, creating a string that&amp;nbsp;&lt;EM&gt;looks like&lt;/EM&gt; a dict. It actually needs to be one. Try something like this, maybe:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;item = source.content.get('itemid')

item.update(item_properties={'tags':item.tags.append('newtag')})&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 02 Oct 2022 11:31:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/add-new-tag-without-removing-existing-ones/m-p/1218127#M7833</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-10-02T11:31:55Z</dc:date>
    </item>
    <item>
      <title>Re: Add new tag without removing existing ones</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/add-new-tag-without-removing-existing-ones/m-p/1218207#M7834</link>
      <description>&lt;P&gt;Although item.tags returns a list, using the append method directly on the property returns None.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis import GIS

agol = GIS("home")

item = agol.content.get("item_id")

tags_1 = item.tags

print(tags_1)
&amp;gt;&amp;gt;&amp;gt; ['tag1', 'tag2', 'tag3']

tags_2 = item.tags.append("newtag")

print(tags_2)
&amp;gt;&amp;gt;&amp;gt; None

## USE THIS
tags = item.tags

tags.append("newtag")

item.update(item_properties={'tags':tags})
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2022 10:19:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/add-new-tag-without-removing-existing-ones/m-p/1218207#M7834</guid>
      <dc:creator>Clubdebambos</dc:creator>
      <dc:date>2022-10-03T10:19:51Z</dc:date>
    </item>
    <item>
      <title>Re: Add new tag without removing existing ones</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/add-new-tag-without-removing-existing-ones/m-p/1218239#M7836</link>
      <description>&lt;P&gt;That did it!&amp;nbsp; thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2022 13:06:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/add-new-tag-without-removing-existing-ones/m-p/1218239#M7836</guid>
      <dc:creator>Rayn</dc:creator>
      <dc:date>2022-10-03T13:06:28Z</dc:date>
    </item>
  </channel>
</rss>

