EPiWiki.se  - EPiServer notes shared with others
 

Find pages with criteria

[Edit]
Sample code to list all pages for a certain page type. Start searching for pages with
a page type ID equal to the parameter pageTypeId starting at pageLink.

The build in properties are listed in build in properties


static public EPiServer.Core.PageDataCollection FindPagesOfPageType(
   EPiServer.Core.PageReference pageLink,
   int pageTypeId)
{
    PropertyCriteriaCollection criterias = new PropertyCriteriaCollection();
    PropertyCriteria criteria = new PropertyCriteria();
    criteria.Condition = EPiServer.Filters.CompareCondition.Equal;
    criteria.Name = "PageTypeID";
    criteria.Type = EPiServer.Core.PropertyDataType.PageType;
    criteria.Value = pageTypeId.ToString(
       System.Globalization.CultureInfo.InvariantCulture);
    criteria.Required = true;
    criterias.Add(criteria);

    return DataFactory.Instance.FindPagesWithCriteria(pageLink, criterias);
}
Version author:
Anonymous

EPiServer version

'EPiServer 4'