Getting a page with a specific value



I'd like to get all the pages of a specific pagetype and filter them based on a property value. I'm guessing that I have to use the FindPagesWithCriteria method, but im not sure how to properly request all the pages of a specific type, and then filter that via LINQ on a specific property value of my choosing.

Any help is much apprechiated!


Jun 16, 2014 11:34


This is the code for the page type criteria.

If you want to get the id of a specific page type and only have the page type class, you can work with the PageTypeRepository - ServiceLocator.Current.GetInstance<PageTypeRepository>()

PropertyCriteria criteria = new PropertyCriteria();
criteria.Condition = CompareCondition.Equal;
criteria.Name = "PageTypeID";
criteria.Type = PropertyDataType.PageType;
criteria.Value = idOfPageType;
criteria.Required = true;

Also add your other criteria based on what kind of value you have on the property.

There are some good get-started blog posts about FindPagesWithCriteria:

Remember to cache your result since FindPagesWithCriteria makes a request directly to the database.

Jun 16, 2014 12:12

Thanks alot Alf!

Jun 16, 2014 12:48
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.