November Happy Hour will be moved to Thursday December 5th.

Tahir Naveed
May 1, 2011
  5163
(4 votes)

Code snippet to modify EPiServer pagetype definitions programmatically.

 

Few days back, I was assigned a project to amend an already created site and enable globalization on it. So I started by enabling globalization in EPiServer admin mode. Once done, the next task was to go to EPiServer edit mode and make “unique value per language” checked for all the properties. There are too many pagetypes that requires changes, so i decided to write a small code that does this for me Smile.

//Get All the pageTypes

PageTypeCollection pageTypeCollection = PageType.List();

foreach (var pagetype in pageTypeCollection)

{

//get all the properties on pagetype

PageDefinitionCollection pageDefinitionCollection = pagetype.Definitions;

foreach (var pageDefinition in pageDefinitionCollection)

{

//Enable globalization and save

pageDefinition.LanguageSpecific = true;

pageDefinition.Save();

}

}

May 01, 2011

Comments

May 2, 2011 10:37 AM

Thankz :)

tamim.khan@netcel.com
tamim.khan@netcel.com May 3, 2011 11:36 AM

Nice tip. Thanks for sharing.

Please login to comment.
Latest blogs
Optimizely SaaS CMS + Coveo Search Page

Short on time but need a listing feature with filters, pagination, and sorting? Create a fully functional Coveo-powered search page driven by data...

Damian Smutek | Nov 21, 2024 | Syndicated blog

Optimizely SaaS CMS DAM Picker (Interim)

Simplify your Optimizely SaaS CMS workflow with the Interim DAM Picker Chrome extension. Seamlessly integrate your DAM system, streamlining asset...

Andy Blyth | Nov 21, 2024 | Syndicated blog

Optimizely CMS Roadmap

Explore Optimizely CMS's latest roadmap, packed with developer-focused updates. From SaaS speed to Visual Builder enhancements, developer tooling...

Andy Blyth | Nov 21, 2024 | Syndicated blog

Set Default Culture in Optimizely CMS 12

Take control over culture-specific operations like date and time formatting.

Tomas Hensrud Gulla | Nov 15, 2024 | Syndicated blog