tools · utilities

How to delete a large amount of items via Sitecore User Interface

We have a Sitecore 7.2 Initial Release (aka Sitecore CMS 7.2.0) project on the table. It’s a legacy system. Sadly, the previous vendor did not cover the case the items were duplicated when they’re created automatically via a Sitecore task scheduler from an external source. After correcting the code logic, we need to delete all the existing items and then run the task scheduler to populate the new items.

Turned out it’s a good chance for us to explore multiple ways of Sitecore item deletions:

  1. using Delete Subitems feature via Content Editor
    • Prerequisite: have permission to delete the items
    • the items are grouped into alphabetical folder items so we can perform the deletions easily
    • dbi_1
  2. performing Delete results search operation on search results directly from Search window via Content Editor
    • Prerequisite: have permission to delete the items and we MUST exclude the root node in the search result before deleting the search result
      • adding Search by ID filter and toggling it to “must not” contain the filter value
      • entering search root node id
      • dbi_5.png
    • click on Search Operations and then Delete Results
    • dbi_4
  3. using Sitecore admin tool DB Browser
    • Prerequisite: be able to access /sitecore/admin/dbbrowser.aspx page 
    • it skips lot of Sitecore pipelines / processors so this way is much faster than #1 and #2
    • dbi_2.png
  4. using Sitecore PowerShell Extension (SPE) module
  5. using Serialization functionality of Sitecore

The Deletion Attempts

dbi_3

  • #1 and #2
    • worked as expected on our local
    • Staging and Production: the Sitecore instance is hosted on a cloud-based content web platform (a kind of Software as a Service) so the deletion executions reached the timeout all the time (there were thousands of descendants)
  • #3
    • worked as expected on our local and Staging
    • Production: it looked working as expected. In fact, it’s not, we quickly recognized that somehow the related media items suddenly were missing their own file attached
    • dbi_3
    • we switched to web database and see that those media items were fine and then transferred the media items from web to master. Somehow it did not update the ones in master database and likewise we could not see the file attached
    • we performed Rebuild the link Database as well but no hope
    • finally, we asked the Gatekeeper to restore the master database
  • #4
    • the Gatekeeper does not allow to install any Sitecore modules so we did not play around with SPE
  • #5
    • worked like a charm for us 🙂
    • personally, I love the approach of my fellow Sitecore MVP Marek Musielak => only serialize the single root item
    • it saves a ton of time because we ONLY can delete the serialized files one by one via File Explorer and there are thousands of descendant (Note: for Sitecore 8 and later, please navigate to /sitecore/shell/default.aspx?xmlcontrol=FileExplorer)
    • dbi_6.png
    • we should ensure that the serialized files are created successfully: please be noticed that for Sitecore 8 or sooner, by default, the serialization folder is inside the data folder which is outside Sitecore website folder so we cannot see it via File Explorer
      • create a patching config file like the following one and upload it to the \App_Config\Include folder via File Explorer
      • dbi_7
      • serialize all the single root nodes and then open the serialization folder, you would see something like this
      • dbi_8

Thanks the awesome Sitecore Community and Happy Sitecore Playing!

 

 

 

 

 

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.