Thursday, 11 September 2014

Get all Page Types in EPiServer

To get all page types in Episerver, use the following code

using EPiServer.ServiceLocation;
using EPiServer.DataAbstraction;

var repository = ServiceLocator.Current.GetInstance<PageTypeRepository>();
var pageTypes = repository.List();

For older versions of Episerver if the above code doesn't work, use the following code.
Note: This function has been obsolete in latest versions of Episerver, but still works.

var pageTypes = EPiServer.DataAbstraction.PageType.List();

1 comment :