<?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 Python Assign User Category in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/python-assign-user-category/m-p/1259023#M50409</link>
    <description>&lt;P&gt;Hello, I'm trying to assign users that currently don't have categories new categories. I found this command screenshotted below in the docs (&lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#arcgis.gis.UserManager" target="_blank"&gt;https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#arcgis.gis.UserManager&lt;/A&gt;).&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Victoria_0-1676413549309.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/63034i99D2854235DB6950/image-size/large?v=v2&amp;amp;px=999" role="button" title="Victoria_0-1676413549309.png" alt="Victoria_0-1676413549309.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The docs says the categories property can be used to &lt;STRONG&gt;get or set&lt;/STRONG&gt; categories. Right now, I'm able to &lt;STRONG&gt;get&lt;/STRONG&gt; a user category with this code:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;all_users = gis.users.search(query='*', max_users=10)
for user in all_users:
    category = user.categories
    print(category)&lt;/LI-CODE&gt;&lt;P&gt;However, I'm trying to &lt;STRONG&gt;set&lt;/STRONG&gt; a user's category and my code is:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;index = 0
for user in all_users:
    user.categories = categories[index] # where categories is a list of lists, each nested list contains the corresponding user's new categories
    ++index&lt;/LI-CODE&gt;&lt;P&gt;Nothing's happening to the user's category in ArcGIS Online when I run my code and I was wondering if anyone has had experience setting user categories with Python?&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
    <pubDate>Thu, 16 Feb 2023 19:16:54 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2023-02-16T19:16:54Z</dc:date>
    <item>
      <title>Python Assign User Category</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/python-assign-user-category/m-p/1259023#M50409</link>
      <description>&lt;P&gt;Hello, I'm trying to assign users that currently don't have categories new categories. I found this command screenshotted below in the docs (&lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#arcgis.gis.UserManager" target="_blank"&gt;https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#arcgis.gis.UserManager&lt;/A&gt;).&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Victoria_0-1676413549309.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/63034i99D2854235DB6950/image-size/large?v=v2&amp;amp;px=999" role="button" title="Victoria_0-1676413549309.png" alt="Victoria_0-1676413549309.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The docs says the categories property can be used to &lt;STRONG&gt;get or set&lt;/STRONG&gt; categories. Right now, I'm able to &lt;STRONG&gt;get&lt;/STRONG&gt; a user category with this code:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;all_users = gis.users.search(query='*', max_users=10)
for user in all_users:
    category = user.categories
    print(category)&lt;/LI-CODE&gt;&lt;P&gt;However, I'm trying to &lt;STRONG&gt;set&lt;/STRONG&gt; a user's category and my code is:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;index = 0
for user in all_users:
    user.categories = categories[index] # where categories is a list of lists, each nested list contains the corresponding user's new categories
    ++index&lt;/LI-CODE&gt;&lt;P&gt;Nothing's happening to the user's category in ArcGIS Online when I run my code and I was wondering if anyone has had experience setting user categories with Python?&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 16 Feb 2023 19:16:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/python-assign-user-category/m-p/1259023#M50409</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2023-02-16T19:16:54Z</dc:date>
    </item>
    <item>
      <title>Re: Python Assign User Category</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/python-assign-user-category/m-p/1259030#M50411</link>
      <description>&lt;P&gt;I believe categories only supports getting the property for user objects. You can set a user's category using the&amp;nbsp;&lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#arcgis.gis.User.update" target="_self"&gt;update()&lt;/A&gt; method.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Feb 2023 19:29:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/python-assign-user-category/m-p/1259030#M50411</guid>
      <dc:creator>PeterKnoop</dc:creator>
      <dc:date>2023-02-16T19:29:32Z</dc:date>
    </item>
    <item>
      <title>Re: Python Assign User Category</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/python-assign-user-category/m-p/1259037#M50412</link>
      <description>&lt;P&gt;Thanks Peter, I'll give this a try!&lt;/P&gt;</description>
      <pubDate>Thu, 16 Feb 2023 19:36:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/python-assign-user-category/m-p/1259037#M50412</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2023-02-16T19:36:34Z</dc:date>
    </item>
    <item>
      <title>Re: Python Assign User Category</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/python-assign-user-category/m-p/1260068#M50479</link>
      <description>&lt;P&gt;Thanks Peter, I was having some issues with my arcgis version but once I updated it, I could use the update() method and successfully assigned categories!&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2023 15:37:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/python-assign-user-category/m-p/1260068#M50479</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2023-02-21T15:37:26Z</dc:date>
    </item>
    <item>
      <title>Re: Python Assign User Category</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/python-assign-user-category/m-p/1328775#M54602</link>
      <description>&lt;P&gt;Got it to apply finally. Here is what worked for me using the user.update()&lt;/P&gt;&lt;P&gt;user.update(categories = ["/Categories/States/Colorado"])&lt;/P&gt;&lt;P&gt;I was trying to apply a category that was nested I suppose...&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2023 16:40:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/python-assign-user-category/m-p/1328775#M54602</guid>
      <dc:creator>RobertWeber</dc:creator>
      <dc:date>2023-09-14T16:40:43Z</dc:date>
    </item>
    <item>
      <title>Re: Python Assign User Category</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/python-assign-user-category/m-p/1413757#M58759</link>
      <description>&lt;P&gt;When I try to use the same code, I get an error that categories isn't a recognized argument for the update() method. But other arguments like description, name, etc. work for me.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Apr 2024 20:29:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/python-assign-user-category/m-p/1413757#M58759</guid>
      <dc:creator>zrobinson_agolpublic</dc:creator>
      <dc:date>2024-04-22T20:29:09Z</dc:date>
    </item>
  </channel>
</rss>

