Views: 3826
Number of votes: 4
Average rating:

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;




May 01, 2011

( 5/2/2011 10:37:22 AM)

Thankz :)
( By, 5/3/2011 11:36:48 AM)

Nice tip. Thanks for sharing.

Please login to comment.