0

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

4

2 回答 2

3

FindPagesWithCriteria 只会为您提供已发布的页面(以及当前用户有权访问的页面),因此不需要将 StopPublish 作为标准。

FindAllPagesWithCriteria 将返回所有页面,包括未发布的页面和当前用户无权访问的页面。

于 2013-10-10T12:51:32.483 回答
0

具有空值的 EPiServer 属性永远不会存储在数据库中。如果您从代码中访问它,它将始终为空。

要使用 PropertyCriteria 搜索空属性,请将IsNull属性设置为 true

于 2013-10-09T12:16:39.657 回答