AI OnAI Off
You can use the EPiServer Community query system to achieve this. This code snippet retrieves all blog entries created between January 6th, 2010 and April 1st, 2010:
EntryQuery entryQuery = new EntryQuery();
CriteriaGroup criteriaGroup = new CriteriaGroup();
entryQuery.Created = new DateTimeCriterion();
entryQuery.Created.Value = new DateTime(2010, 01, 06);
entryQuery.Created.Operator = ComparisonOperator.GreaterThan;
criteriaGroup.AddCriterion(entryQuery.Created);
entryQuery.Created = new DateTimeCriterion();
entryQuery.Created.Value = new DateTime(2010, 04, 01);
entryQuery.Created.Operator = ComparisonOperator.LessThan;
criteriaGroup.AddCriterion(LogicalOperator.And, entryQuery.Created);
entryQuery.CriteriaGroups.Add(criteriaGroup);
entryQuery.OrderBy.Add(new CriterionSortOrder(entryQuery.Created, SortingDirection.Descending));
EntryCollection entries = QueryHandler.GetQueryResult(entryQuery);
Karoline
Thanks for the tip, but I got it working using BlogHandler in the end so that I get caching and everything. It was possible to pass null for the IUser reference. The Blog.GetEntries call failed because it would filter down to a BlogHandler call where the flag "byPublishDate" would be false which probably messed things up since I'm interested in the creation date.
I just want to list blog entries between specific dates. But to do that from BlogHandler.GetEntries I have to set an IUser object for which the read status is checked - which won't work for anonymous users. If I use Blog.GetEntries instead it seems to ignore my data limitations completely. What to do?