I'm having problems deleting an item in Portal for ArcGIS. It is delete protected so I can't delete using the UI. I am unable to change the delete protection because the edit button is also disabled. I used ArcGIS Online Assistant and tried to change the delete protection from there but the change from true to false wouldn't actually take. It just kept reverting back. I tried to find the xml or json file in the item ID folder on the Portal server itself, but I couldn't find the delete protection attribute. I'm hesitant to just outright delete the item ID folder itself because I don't know if the item ID is registered anywhere else (a user's item list for instance). Could anyone instruct me on a thorough way to force delete an item from Portal for ArcGIS?
I have also had a problem deleting an item from Portal after upgrading (in this case, 10.4.1 -> 10.6.1). When I hit the delete button, a toast pops up that just gives a general error. I found out that if I make any edit to the Portal item, such as changing the name of item, or tags, etc., and then save the change, I can then delete the item.
My problem is that these items don't exist in the Portal site...they only appear on the 'back-end' when navigating through the portal content interface. In there, deleting the items simply doesn't work.
If you have orphaned items, deleting files on disk outside of going through the Sharing API won't remove them from the index, which is why they continue to be returned via searches and within the Portal site. Deleting an item through the Sharing API will remove the item from the index.
You could try to reindex after deleting them, but you run a chance of a discrepancy between the database counts and the index counts.
I just had a problem "arcgis portal failed to determine if item can be deleted" where the problem was related to a bad manual copy/paste error in the Data Source URL, making it invalid. While the Map Image Layer data source URL was invalid, Portal could not figure out if the item was able to be deleted, so it could not delete the item from Portal. This is a 10.6.1 portal/server federated environment.
To delete the item from portal which I knew to be invalid rather than doing these steps https://support.esri.com/en/technical-article/000016345
I deleted the invalid URL leaving the data source URL blank, then I was able to delete the item from portal.
If this helps anyone, you can delete an item via this URL:
https://[your server]/[your portal name]/sharing/rest/content/users/[your username] - This will show you the content you own, then you can click on the item, then delete it. I had to do this for content that was not showing up in Portal for ArcGIS. I knew it was there and went looking for it and found it via the URL above.
Imtiaz Syed - Nice script, thanks for sharing.