Try our conversational search powered by Generative AI!

Tahir Naveed
May 1, 2011
  5075
(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 Forms: Safeguarding Your Data

With the rise of cyber threats and privacy concerns, safeguarding sensitive information has become a top priority for businesses across all...

K Khan | May 16, 2024

The Experimentation Process

This blog is part of the series -   Unlocking the Power of Experimentation: A Marketer's Insight. Welcome back, to another insightful journey into...

Holly Quilter | May 16, 2024

Azure AI Language – Sentiment Analysis in Optimizely CMS

In the following article, I showcase how sentiment analysis, which is part of the Azure AI Language service, can be used to detect the sentiment of...

Anil Patel | May 15, 2024 | Syndicated blog

Optimizely Data Platform Visitor Groups now supports multiple instances

The module V2.0 now supports multiple Optimizely Data Platform instances, allowing personalized content based on real-time segments and profile dat...

Andrew Markham | May 15, 2024 | Syndicated blog