Cannot Delete Document or List Item From SharePoint

Category: SharePoint

Please rate this blog post!

How to Delete a Document or Item from SharePoint

So, you have a list item or document in a library that no matter what you do, it just won’t let you delete it or undo a check out. You are sure you have the proper permissions, but alas, the document or item is even more stubborn than me and just won’t go away!

  1. Perhaps one of the issues below has occurred:
    • Someone renamed a document that was already uploaded and it became corrupt.
    • Something was checked out by another user who is no longer there and it went bonkers so you can’t check it back in to delete it.
    • There was custom code written that has somehow altered the document and it has now become unruly.

    Here are the steps I perform when I cannot delete documents & list items in SharePoint that are being a wee bit insubordinate:

 


  1. Selecting Delete or Undo Checkout. You have probably tried this already or you wouldn’t be reading this article, but here we go. While you are logged in as the Farm Admin or Site Collection Admin, attempt to delete the document or list item by clicking the arrow to the right of the document and selecting delete or checking the box to the left of the document and using the ribbon to select delete.

CannotDeleteDocumentListItem1

  1. Content and Structure. This feature will only be available if Publishing is enabled on your site. By selecting  Site Actions –> Manage Content and Structure, follow the same steps above by  clicking the delete option in the drop down or via the ribbon under Actions–> delete with the box checked next to the document (if you do not see this option in the drop down you do not have a high enough permission level).

CannotDeleteDocumentListItem2


CannotDeleteDocumentListItem3

 

3. Open in Windows Explorer.  Thanks to Howard Pearse for this idea. In this example, the context is in Russian, but the button is always in the same place in the ribbon bar (at least in SP2010). This option basically opens the lists/libraries in more of a folder like view. I don’t believe this option is there for a list however, only libraries.

CannotDeleteDocumentListItem9

 

CannotDeleteDocumentListItem10

4. PowerShell.  As an Administrator, go onto the server and open PowerShell.

CannotDeleteDocumentListItem6

5. Use SharePoint Designer. Thanks to Divyesh Chauhan for this idea. It is important to perform the steps below as initially when I tried this, I had SPD installed locally on my machine and it deleting the document did not work. Install SharePoint Designer on the server (if you want to take a backup of the server first I understand). Run SPD as an Administrator (right click – Run as Administrator) and make sure you are using either the Farm Admin ID, the System Account or one of the Service Account IDs (you may need to try all of these IDs as I had mixed results myself).   You can now uninstall SPD from the server if you would like to.

CannotDeleteDocumentListItem4CannotDeleteDocumentListItem5

6. SQL Server Database / SQL Query.  Finally, I am mostly certain this is not supported by MSFT, however it has worked for me in the past as an absolute last resort (take a backup of that database before you touch it just in case!). It’s time to go directly into the SQL tables to find the specific item by GUID (The full instructions are included in this blog post from Marc Mathot:  http://sharepointfordummies.blogspot.com/2013/05/how-to-delete-corrupt-file-entry-in-sql.html ).

CannotDeleteDocumentListItem7

Now that we have the GUID to delete the document, it must be removed from both of these tables:

  • AllDocs
  • AllDocsStreams

CannotDeleteDocumentListItem8

If you are removing a list item instead of a document, there may be different SQL tables you need to query and delete from than the 2 listed above.

 

Other Completely Untested, Unsupported, Warranty Invalidating & Farm Disabling Ideas

  • If the document is checked out to someone who no longer is there, delete the person’s ID who has it checked out. I am not sure what would happen with this, but feel free to let me know if you are brave enough to do it (evil grin).

Have any other ideas on to remove corrupt or undeletable items and documents from SharePoint? Post your comments below.

13 comments

  1. What about doing the following:
    – Click on Library > Open with Explorer
    – Click on the document name
    – Press Delete

    Also, Site Content and Structure only works if you’ve activated Site Publishing or if you replace “SitePages/Home.aspx” at the end of the Home Page URL with “_layouts/sitemanager.aspx?Source=/sites/SITENAME/SitePages/Home.aspx

  2. You just made something that I thought was so difficult be, truly, so easy! Thanks for the post!

  3. That did the trick! Made me look good by making it look easy.
    From the library you selection Actions > Open with Windows Explorer. Then select the files you want and click delete.

  4. I had this same issue and arrived at this post. My problem was I deleted all folders and files in a library but yet some folders remained that I was unable to delete or check in. I discovered even as an admin, there were files in the folders that I could not see because they were never checked in. Once I “managed the files with no checked in values” I was able to delete those files and in turn the folders went away too.

  5. I had an issue where I wasn’t able to delete a file because SharePoint said it was checked out to me.

    However the checked out field was empty. I tried to check the file in, but I couldn’t because it wasn’t checked out.

    What I was able to do was open the file for editing. Once I saved the file, I was able to delete it.

  6. Typical of Microsoft to make something that ought to be easy to do, hard. I rue the day my organization chose O365 over Google Docs/Drive/Apps.

  7. Well, Google isn’t perfect either but I understand what you are saying about the lack of easy to find documentation with multiple examples to fit each person’s needs available on the internet. I hope this article helped at least.

Leave a Reply

Your email address will not be published.