We know that in Sitecore content editor, if we want to remove a version of an item, just go to the “Versions” tab then click the “Remove” button. Sounds easy enough, but recently I ran into an related issue that I had to use the database browser administrative tool to resolve.
I was working on some templates and accidentally I added another language version of a template. Templates shouldn’t have versions, and you cannot add a version for a template in the normal way you do with other items, by clicking the “Add” button in “Versions” tab. But guess what, you can add one by switching to another language, and click the “Add a new version” link in the no version warning:
Naturally, I wanted to remove that accidentally added version. However, there’s no versions commands for template items in Sitecore ribbon, obviously they think templates won’t have versions so no need to have remove button as well, yet they left a possibility to add one… so this may happen not only by this way, but in other situations like using a script to create versions:
So how should I delete this version, will I eventually end up with using sql commans to operate the database directly? Yes for operating the database, but using Sitecore database browser. This administrative tool can be viewed on via sitecore/admin/dbbrowser.aspx. It looks pretty like the content editor with raw values mode on, but with some very useful bonus features like delete item’s children, and the most important one in my situation – the “delete version” command for all items including template items:
So with the database browser I could delete the unwanted version. This can be very useful too when you want to delete a bunch of an item’s children without deleting itself.
Thanks for reading.