Bulk deletion of portal items

493
2
05-22-2017 09:49 AM
AnneleyMcMillan2
New Contributor II

Hi there, 

I was wondering what might be the easiest way of clearing out Portal items after a certain amount of time. I'd ideally want a script to run every day, and if portal items were more than a certain age (whoever had put them in), for them to be deleted. Is there anything in the ArcGIS API that would help with this?

Thanks!

0 Kudos
2 Replies
JonathanQuinn
Esri Frequent Contributor


Technically, I think your best bet would be to use Python or another scripting language to make requests to the JSON of the item.  You can then look at the created or modified date as well as the number of reviews to determine if the item should be deleted or not.

Whether it's possible to do or not aside, there's no "undo" button for deleting items, (as long as you don't take backups).  If you want to clean up your portal for people searching items, a better approach may be to unshare items that are shared to a group, organization, or everyone and only have them accessible by the item owner. That way, you're not deleting any users data automatically, but instead, making sure that other people within your organization can't access an item that may be out of date.  Going back to my first sentence, I would also run regular backups to make sure that mistakes can be undone.

JohnPlunkett
Esri Contributor

Another option that you could invest in is GEO Jobe Admin Tools for ArcGIS Online 

There is an option for purchasing an option to for your ArcGIS Portal

This would be a manual process however you will be able to see what you delete first