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?
Hi Clinton,
I went back to my Portal Content page where the orphan Item was located, clicked its select checkbox, then used the 'change owner' option. I moved the item owner to a different portal username, (which I think forces an update to WA url the new owner is under) then was successful deleting the item through the REST API under that user name. (maybe the delete would've worked through Portal Content also)
Clean Portal! Yaaaay! Hopefully works for you
First check if the item is a hosted layer or a item which is hosted with ArcGIS Data Store, if is a hosted item then you need to put your federated server as hosting server and then try to delete the item, one important thing when you federate a server and try to remove a item from arcgis server manager is that it should be removed from portal too, if that doest not happen then you have a problem with your federate process, check that the dns used in your web adaptor config and the federation config is correct.
@Roberth Sanchez
None of the items I am trying to delete are hosted in feature layers. I cannot remove any orphaned items Portal even with the site administrator in the portal content interface and using force delete.
However, you are the first person to suggest that removing items from Server will remove them from Portal. Esri Technical Services told me that the process is to remove them from both locations in a federated environment.
Further: Federation was accomplished using the Cloud Builder.
They say that because is a regular problem, but in my case i check that with a wrong configuration with the federated server got that result (not removed in both sides), and with a correct configuration when i remove layers from arcgis server manager then are automatically removed from portal, even if the user logged in arcgis server manager is not the user of portal that upload or share the layer, what i don't know if that change in other versions i'm using ArcGIS 10.5.
Regards.
They say that because is a regular problem,
Oh man...I'd like to believe that is not true...but I can't rule that out.
Can you tell me a bit more about the exact DNS configuration to investigate? Even if this does work (the automatically deleting), I kind of doubt I'm going to be able to successfully delete these orphaned items.
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.
Interesting behavior...hmm...
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.
import arcgis
from arcgis.gis import GIS
gis = GIS("https://portalname/arcgis", "username", "password")
#get the list of orphaned items
delete_orphaned_items = gis.content.search(query="owner: ownername AND title:*title*",item_type='Feature *', max_items=100)
delete_orphaned_items
#filter the items
filtered_items = [item for item in delete_orphaned_items if 'title' in item.title]
sorted(filtered_items, key=lambda x:x.title)
#replace dry_run with force. dry_run checks if the item can be safely deleted
for item in filtered_items:
try:
item.delete(dry_run=True)
except TypeError:
print(f'{item.title} not deleted')
except RuntimeError:
print(f'{item.title} not deleted')
Delete an item in Portal for ArcGIS using arcgis.gis module: https://esri.github.io/arcgis-python-api/apidoc/html/arcgis.gis.toc.html#item