i wonder if someone else has come accross this issue. I am trying to use FindPagesWithCriteria and i am creating my property criteria as like this:

PropertyCriteria dateCriteria = new PropertyCriteria();
dateCriteria.Condition = CompareCondition.GreaterThan;
dateCriteria.Name = "PageStopPublish";                
dateCriteria.Type = PropertyDataType.Date;
dateCriteria.Value = DateTime.Now.ToString();
dateCriteria.Required = true;

so i am trying to find all the pages that are not expired. However, some pages may not have StopPublish property set in which case Datetime.MaxValue should be used. But in this particular case (no StopPublish value set) FindPagesWithCriteria will not return any results. Is there a reason for this or is it a bug? As a workaround, i am returning using PageTypeName criteria and then applying some additional filterin for returned PageDataCollection

有帮助吗?

解决方案

FindPagesWithCriteria will only give you published pages (and pages that the current user have access to) so having StopPublish as a criteria is not necessary.

FindAllPagesWithCriteria will return all pages, including unpublished pages and pages the current user does not have access to.

其他提示

EPiServer properties with an empty value are never stored in the database. If you access it from code, it will always be null.

To search for a null property using PropertyCriteria, set the IsNull property to true

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top