For some reason sitecore has created multi-versions in all languages. Is there way to delete all the version and the languages besides default language through Site core Rocks Query?
Thanks
For some reason sitecore has created multi-versions in all languages. Is there way to delete all the version and the languages besides default language through Site core Rocks Query?
Thanks
On
You can remove this language from the system and it will take care this item, then publish the site - this will resolve this issue.
If you still have any issue - Please remove this explicitly, Below is the sample code
I have used this code to add version for all languages, May be this help to remove explicitly.
var homeItemA = Sitecore.Context.Database.GetItem(Landings.HomeItem); var languageA = Sitecore.Globalization.Language.Parse("en-SG");//new language version
var master = Sitecore.Configuration.Factory.GetDatabase("master");
var allItems = master.GetItem(homeItemA.Paths.FullPath).Axes.GetDescendants();
foreach (var blog in allItems)
{
Item ca = master.GetItem(blog.Paths.FullPath, languageA);
using (new Sitecore.SecurityModel.SecurityDisabler())
{
try
{
if (0 == ca.Versions.Count)
{
ca.Versions.AddVersion();
}
}
catch (Exception ex)
{
ca.Editing.CancelEdit();
}
}
}
You can delete the language item from the system/Languages and it will remove this language version from all the items automatically.