代码之家  ›  专栏  ›  技术社区  ›  PhilPursglove

在EpiServer中查找新的和更新的页面

  •  0
  • PhilPursglove  · 技术社区  · 15 年前

    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 )-这将返回一些结果,但当我尝试使用结果集构建一个页面集合以数据绑定到页面列表中时,同样没有任何输出。我看不出我能把它用在新的页面上,只有更新的页面。

    1 回复  |  直到 15 年前
        1
  •  4
  •   Johan Kronberg    15 年前

    属性名应为“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);
    
    推荐文章