More in this section

Forums / Developing with Sitefinity / Delete all pages created for one language

Delete all pages created for one language

5 posts, 1 answered
  1. Constantin Aparaschivei
    Constantin Aparaschivei avatar
    27 posts
    Registered:
    10 Nov 2009
    22 Feb 2010
    Link to this post
    Hi,

    I have a website developed with sitefinity 3.6 with localization enabled. My pages were created in multiple languages.

    What I need to do now is to delete all content for a specific language. Is there any script that will do this? Manual delete will take me a week.

    Thanks,
    Aparaschivei Constantin
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    22 Feb 2010
    Link to this post
    Hello Constantin Aparaschivei,

    The page object does not contain content, because you are using controls to add content to a page. Below is a sample code that illustrates how to access certain page language version. You can edit page controls or delete the page using DeleteLanguageVersion method of ICmsPage object.

    CultureInfo cult = null;
            var cmsManager = new CmsManager();
            ICmsPage cmsPage = (ICmsPage)cmsManager.GetPage(new Guid("22469CEF-6B72-4218-8D0F-4F8346823E1A"));
            if (cmsPage != null)
            {
                foreach (IPageContent pageContent in cmsPage.LanguageVersions.Values)
                {
     
                    cult = CultureInfo.GetCultureInfo(pageContent.LangID);
                    if (cult.Name == "bg")
                    {
                       int control =  pageContent.Controls.Count();
                    }
                     
                }
            }


    Regards,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
    Answered
  3. Constantin Aparaschivei
    Constantin Aparaschivei avatar
    27 posts
    Registered:
    10 Nov 2009
    22 Feb 2010
    Link to this post
    The DeleteLanguageVersion method will delete the page version and all content that was placed for the specific language (generic content) ? I need to clean the database as much as possible.

    Thanks.
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    22 Feb 2010
    Link to this post
    Hello Constantin Aparaschivei,

    The method DeleteLanguageVersion will delete the whole language version and all controls that have been placed on  this page.

    Regards,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  5. Constantin Aparaschivei
    Constantin Aparaschivei avatar
    27 posts
    Registered:
    10 Nov 2009
    22 Feb 2010
    Link to this post
    Thanks for your answer.
Register for webinar
5 posts, 1 answered