Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

Check if pagetype by using contenttypes guid?

Vote:
 

How can I do a check to see if a page (pagedata) are is a pagetype with the by comparing the guid?

I know what guid the pagetype has, but how can I check that field by code if I have a PageData reference?

#80988
Feb 06, 2014 14:16
Vote:
 

var contentRepository = ServiceLocation.ServiceLocator.Current.GetInstance<IContentRepository>();

var page = contentRepository.Get(someReference);

IContentTypeRepository contentTypeRepository = Locate.ContentTypeRepository();

var contentType = contentTypeRepository.Load(page.ContentTypeID);

var guid = contentType.Guid;

#80992
Edited, Feb 06, 2014 14:30
Vote:
 

Thanks a moderload!

#80998
Feb 06, 2014 15:45
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.