One of the challenges when deleting files stored in SharePoint is to ensure that there are no links to those files. This is especially important for assets on public-facing websites. And although SharePoint keeps track of links between the different files, it doesn’t do anything with them while deleting files.
Governing files becomes more and more challenging the more your website grows. And although you could choose never to delete any file, it’s often better to remove or at least archive files that are not being used. But how do you know for sure which files are still being used and which are safe to archive or to remove?
Show related resources
Since the 2007 version SharePoint allows you to discover which files in your Site Collection are being linked to. To see the related resources, from the Site Settings menu choose the Manage Content and Structure option and from the toolbar click the Show Related Resources button.
Whenever you select a file in the top panel, the bottom panel will show the list of all files in your Site Collection that reference the file that you have selected.
So why not use this information for prompting users when trying to delete files that are being used?
Inconvenient deleting files in SharePoint 2010
You can delete an item in many ways in SharePoint 2010. First of all you can navigate to the particular Document Library, find your file, and delete it using the context menu (ECB).
The same applies to list items.
Another option is to select multiple items and delete them using the Delete Document button in the Ribbon.
Yet another way is to navigate to the Content and Structure Manager and to delete the particular item there.
Depending on which way you choose, SharePoint uses different logic to delete the selected items.
Additionally you can also delete a file using WebDAV or programmatically, but in those scenarios there is no UI that you could interact with.
Using different code to delete an item is not really surprising. After all with the introduction of fluent UI in SharePoint 2010, the user experience has changed as well introducing new ways of interacting with SharePoint. At the same time everyone expected everything that has been done in SharePoint 2007 to keep working with SharePoint 2010.
Considering improving the user experience around deleting files that are being used you would have to take care of all the different ways in which a file can be deleted to provide consistent user experience.
Introducing Mavention Safe Delete
Mavention Safe Delete is a SharePoint 2010 Farm Solution that helps users ensure that they are not deleting files that are still being used. Upon installation it works in the background and every time a user tries to delete a file it checks if that particular file or files are still being used. If so, the user is being prompted with the list of files that are being used and by what files they are being used. He can then choose whether to proceed with deleting the selected file or not.
Mavention Safe Delete works both when deleting files as well as list items. At this moment it supports List, Document Libraries and the Content and Structure Manager.
Installing Mavention Safe Delete
Upon the deployment of the Mavention Safe Delete Solution Package, the only thing you need to do is to activate the Mavention Safe Delete Site Collection Feature.
Mavention Safe Delete requires jQuery. If your website doesn’t use jQuery you can have Mavention Safe Delete install jQuery on your site by activating the Mavention Safe Delete – jQuery Site Collection Feature.
Download: Mavention Safe Delete (47KB, WSP)