PropertyCriteriaCollection col = new PropertyCriteriaCollection(); // create a criteria to include pages published in the last 7 days PropertyCriteria critCreated = new PropertyCriteria(); critCreated.Condition = EPiServer.Filters.CompareCondition.GreaterThan; critCreated.Type = PropertyDataType.Date; critCreated.Name = "PageStartPublish"; critCreated.Value = DateTime.Now.AddDays(-7).ToString(); critCreated.Required = true; col.Add(critCreated); // pass the criteria into the find method to locate all pages matching the criteria. PageDataCollection pages = Global.EPDataFactory.FindPagesWithCriteria(Global.EPConfig.RootPage, col); newContentNewsList.DataSource = pages; newContentNewsList.DataBind();Cheers, Jeremy.
Hmm, I have been stuck with this for a while until I saw this example and noticed that you are using PageStartPublish and I am using StartPublish when adding criteria. BUT the strange thing is that I am using StartPublish when rendering out the result?!
I can not find any property called PageStartPublish and still it works?!
Can someone explain where PageStartPublish comes from?
All built in metadata properties ( like start publish, name, and category) are prefixed by "Page", ie PageName, PageCategory and PageStartPublish. So when you want to search for them or get them directly from the PageData objects Property collection, you need to use that name ( CurrentPage.Property["PageStartPublish"] ).
However, the PageData class has a few convenience accessors to the most common ones. That's why you can access the value directly through CurrentPage.StartPublish. However the actual backing store will store the property as PageStartPublish.
EPiServer CMS Develompent Team