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!
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:
Note!Remember to cache your result since FindPagesWithCriteria makes a request directly to the database.
Thanks alot Alf!