<?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: User Delete - not licensed by user error in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/user-delete-not-licensed-by-user-error/m-p/1055966#M6030</link>
    <description>&lt;P&gt;File an "Issue" on the arcgis-api site&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/Esri/arcgis-python-api/issues" target="_blank"&gt;Issues · Esri/arcgis-python-api (github.com)&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 08 May 2021 10:26:27 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2021-05-08T10:26:27Z</dc:date>
    <item>
      <title>User Delete - not licensed by user error</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/user-delete-not-licensed-by-user-error/m-p/1055907#M6029</link>
      <description>&lt;P&gt;Our code for deleting inactive users on AGOL is failing on the user.delete() command after upgrade to Pro 2.7.0 using the python api 1.8.4. The final return is "Exception: not licensed by user (Error Code: 400)" with full return in attached file. These users do not have content or own groups or have any special licensing. To verify, a new test user with no content, etc. was created and exhibited the same issue. Upgraded to Pro 2.7.3 and api 1.8.5 did not solve the issue. Going back to the base python 3.7.9 install from the ve also did not change the error. As it seems related to entitlements, I added a license to the user to see if the error changed, it didn't. The user can be deleted manually via AGOL, and a different machine running Pro 2.3.2 and I believe api 1.6.2, can run this command without error. None of our other python api commands seem to be failing. Ideas on what I'm missing?&lt;/P&gt;</description>
      <pubDate>Fri, 07 May 2021 22:29:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/user-delete-not-licensed-by-user-error/m-p/1055907#M6029</guid>
      <dc:creator>AdamMesser1</dc:creator>
      <dc:date>2021-05-07T22:29:47Z</dc:date>
    </item>
    <item>
      <title>Re: User Delete - not licensed by user error</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/user-delete-not-licensed-by-user-error/m-p/1055966#M6030</link>
      <description>&lt;P&gt;File an "Issue" on the arcgis-api site&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/Esri/arcgis-python-api/issues" target="_blank"&gt;Issues · Esri/arcgis-python-api (github.com)&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 08 May 2021 10:26:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/user-delete-not-licensed-by-user-error/m-p/1055966#M6030</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-05-08T10:26:27Z</dc:date>
    </item>
    <item>
      <title>Re: User Delete - not licensed by user error</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/user-delete-not-licensed-by-user-error/m-p/1059089#M6081</link>
      <description>&lt;P&gt;Will do. Thanks &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/215600"&gt;@DanPatterson&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 May 2021 18:23:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/user-delete-not-licensed-by-user-error/m-p/1059089#M6081</guid>
      <dc:creator>AdamMesser1</dc:creator>
      <dc:date>2021-05-18T18:23:55Z</dc:date>
    </item>
    <item>
      <title>Re: User Delete - not licensed by user error</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/user-delete-not-licensed-by-user-error/m-p/1061166#M6117</link>
      <description>&lt;P&gt;Thanks for posting about this! I ran into the same issue!&amp;nbsp;&lt;/P&gt;&lt;P&gt;As a workaround, you could hit the REST API directly. You can do this by using the &lt;A href="https://www.w3schools.com/python/module_requests.asp" target="_self"&gt;'Requests'&lt;/A&gt;&amp;nbsp;library and Esri's &lt;A href="https://developers.arcgis.com/rest/users-groups-and-items/delete-user.htm" target="_self"&gt;REST API&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;token = gis._con.token
url = '{0}/sharing/rest/community/users/{1}/delete?f=json&amp;amp;token{2}'.format(gis.url, username, token)
deleteAgolUser = requests.post(url)
print("Delete User Results for user {0}: {1}".format(username, deleteAgolUser.text)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"token" in the above snippet, gets the token that is generated when you authenticate using GIS. &lt;A href="https://community.esri.com/t5/arcgis-api-for-python-questions/get-the-token-using-arcgis-python-api/m-p/876345" target="_blank" rel="noopener"&gt;See this post for more details.&amp;nbsp;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The 'print' statement is just something that I use, feel free to ignore it!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this helps someone!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Mon, 24 May 2021 21:38:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/user-delete-not-licensed-by-user-error/m-p/1061166#M6117</guid>
      <dc:creator>ChristopherSchreiber</dc:creator>
      <dc:date>2021-05-24T21:38:25Z</dc:date>
    </item>
    <item>
      <title>Re: User Delete - not licensed by user error</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/user-delete-not-licensed-by-user-error/m-p/1070463#M6232</link>
      <description>&lt;P&gt;Url is formatted slightly wrong, should be:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;url = '{0}/sharing/rest/community/users/{1}/delete?f=json&amp;amp;token={2}'.format(gis.url, username, token)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also this is python 3 so you would want to use an f string instead&lt;/P&gt;&lt;LI-CODE lang="python"&gt;url = f'{gis.url}/sharing/rest/community/users/{username}/delete?f=json&amp;amp;token={token}'&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 21 Jun 2021 14:49:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/user-delete-not-licensed-by-user-error/m-p/1070463#M6232</guid>
      <dc:creator>CarlVricella</dc:creator>
      <dc:date>2021-06-21T14:49:33Z</dc:date>
    </item>
    <item>
      <title>Re: User Delete - not licensed by user error</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/user-delete-not-licensed-by-user-error/m-p/1095433#M6588</link>
      <description>&lt;P&gt;According to &lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html?highlight=delete%20user" target="_self"&gt;ArcGIS API reference&lt;/A&gt;&amp;nbsp;, "y&lt;SPAN&gt;ou can not&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="highlighted"&gt;delete&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;a&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="highlighted"&gt;user&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;in Portal if that user owns groups or items and/or is assigned an application bundle. If you specify someone in the reassign_to argument, then items and groups will be transferred to that user. If that argument is not set then the method will fail if the user has items or groups that need to be reassigned."&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Moreover, all assigned licenses to a user must also be revoked before you can delete the user.&amp;nbsp;This is missing in the API Ref.&amp;nbsp;&lt;/P&gt;&lt;P&gt;In short, before you can delete a user using ArcGIS API you need,&lt;/P&gt;&lt;P&gt;1- Remove or transfer the user's all items and owning groups&amp;nbsp;&lt;/P&gt;&lt;P&gt;2- Remove all assigned app bundles.&lt;/P&gt;&lt;P&gt;3- Revoke all assigned licenses.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;CCGT_UAV&lt;/P&gt;</description>
      <pubDate>Fri, 03 Sep 2021 19:55:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/user-delete-not-licensed-by-user-error/m-p/1095433#M6588</guid>
      <dc:creator>CCGT_UAV</dc:creator>
      <dc:date>2021-09-03T19:55:14Z</dc:date>
    </item>
    <item>
      <title>Re: User Delete - not licensed by user error</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/user-delete-not-licensed-by-user-error/m-p/1098740#M6640</link>
      <description>&lt;P&gt;Correct CCGT_UAV, however, I indicated that I checked those and created a test user with no privileges to verify. Thanks for pointing folks to the API reference.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Sep 2021 23:22:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/user-delete-not-licensed-by-user-error/m-p/1098740#M6640</guid>
      <dc:creator>AdamMesser1</dc:creator>
      <dc:date>2021-09-15T23:22:43Z</dc:date>
    </item>
    <item>
      <title>Re: User Delete - not licensed by user error</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/user-delete-not-licensed-by-user-error/m-p/1121355#M6858</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;It seems like the &lt;SPAN&gt;"Error Code: 400 not licensed by user" when trying to delete a member was due to a defect in ArcGIS API for Python (1.8.X).&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;This has been addressed in 10.9 version.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Nov 2021 18:02:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/user-delete-not-licensed-by-user-error/m-p/1121355#M6858</guid>
      <dc:creator>MJBiazar</dc:creator>
      <dc:date>2021-11-30T18:02:55Z</dc:date>
    </item>
  </channel>
</rss>

