Select to view content in your preferred language

How to bulk delete old accounts that have delete protection on?

740
6
03-06-2026 02:20 PM
DavidMedeiros
Frequent Contributor

I'm attempting to clean up our AGO Org by removing older inactive user accounts (permanently deleting the accounts and data). From the Org Members page I can filter and select all members with log in dates beyond our threshold then bulk delete them. However, I always get the error message "Unable to delete members that own items with delete protection enabled.".

AGO fails to delete ANY of the accounts if just one has a delete protected layer. Just before the bulk delete there is an option to view the combined data layers from the selected members. But there is no way to bulk edit the delete protection settings. This basically just leaves me having to remove in-active accounts one at a time and manually change any data protection setting these old accounts have set up. As an admin, I need MUCH better tools than this to run our org.

Am I missing something that would allow me to bulk remove these old account and their data regardless of data protections wettings?

 

 

0 Kudos
6 Replies
RhettZufelt
MVP Notable Contributor

It can be done with the python API.

Just tested this and it works.  You could loop through/select (query by user, etc.) the items you want to turn off delete protection.  Could also use it to delete them as well.

from arcgis.gis import GIS
gis = GIS("your_gis_url", "username", "password")

#Get the item by its ID
item_id = "item ID"
item = gis.content.get(item_id)
# Turn off delete protection
item.protect(enable=False)

R_

 

0 Kudos
DavidMedeiros
Frequent Contributor

I'll take a look at this, thank you. But in my opinion an org admin should not have to resort to custom python scripts to do these simple maintenance tasks. This should be a dashboard operation.

0 Kudos
ErikRose
Occasional Contributor

Since delete protection is opt-in, and designed to prevent accidental deletion, wouldn't this feature undermine the value that delete protection is supposed to confer on your data?

DavidMedeiros
Frequent Contributor

As an admin of a org with very high turn over (academic University) and over 4700 members (MANY of them inactive for several years), there needs to be a way to quickly clear out old accounts. If the account is inactive and over our stated grace period for content migration we need to be able to easily remove the old accounts and data - without having to resort to bespoke python scripts. This should be built in. FYI I'm currently looking at clearing accounts that are over 10 years old! It should not be this hard to remove them.

0 Kudos
DavidMedeiros
Frequent Contributor

I want to add that the big issues here are that 1) as an admin I should be able to easily override user settings if needed, esp for decade old accounts (user should not be be able to block admin control) and 2) even without that, the bulk delete function should be able to complete the delete for all selected accounts that do not have delete protection and just ignore those that do. That way I can at least whittle down to the the accounts the need manual remediation instead of it dropping the whole task.

0 Kudos
J_DavidMacLean
Occasional Contributor

Hi David:

I've found that GeoJobe's Admin Tools work very nicely (for many things related to managing an academic AGOL system). These do include an "Update Items Delete Protection" capability, too; even for bulk. Might be helpful to you. Try https://apps.geopowered.com/admin-tools/basic/#/

Best - Dave