我需要在我们的Episerver内联网中显示新创建和更新的页面列表 - 比如每个页面的最后十个。我已尝试使用FindPagesWithCriteria
,但这不会返回任何结果。这是我尝试过的代码:
PageDataCollection recentPages;
PropertyCriteriaCollection criteria;
PropertyCriteria upperBound;
PropertyCriteria lowerBound;
criteria = new PropertyCriteriaCollection();
upperBound = new PropertyCriteria();
upperBound.Condition = CompareCondition.LessThan;
upperBound.Type = PropertyDataType.Date;
upperBound.Value = DateTime.Today.ToString();
upperBound.Name = "Created"; // Or Saved for updated pages
criteria.Add(upperBound);
lowerBound = new PropertyCriteria();
lowerBound.Condition = CompareCondition.GreaterThan;
lowerBound.Type = PropertyDataType.Date;
lowerBound.Value = DateTime.Today.AddDays(-7).ToString();
lowerBound.Name = "Created";
criteria.Add(lowerBound);
recentPages = DataFactory.Instance.FindPagesWithCriteria(PageReference.StartPage, criteria);
我也尝试使用RecentlyChangedPagesFinder
(如详细here) - 这会返回一些结果,但是当我尝试使用结果集来构建一个PageCollection来将数据绑定到一个PageList时,我没有得到任何输出。我无法看到我可以将它用于新页面,只有更新的页面。
答案 0 :(得分:4)
属性名称应为“PageCreated”。
http://epiwiki.se/developing/properties/all-built-in-properties
您还可以通过以下方式改进FindPagesWithCriteria语法:
var criterias = new PropertyCriteriaCollection
{
new PropertyCriteria()
{
Name = "SomeProp",
Type = PropertyDataType.PageType,
Value = "eh",
Condition = CompareCondition.Equal,
Required = true
},
new PropertyCriteria()
{
...
};
var pages = DataFactory.Instance.FindPagesWithCriteria(somePageLink, criterias);