0

I want a widget on the front page of an intranet. It should display the count of number of pages that have been changed n number of days back.

I tried something like this, but it always returns 0

var changeLog = (IChangeLog)ClassFactory.CreateInstance(typeof(IChangeLog), new object[0]);
ChangeLogQueryInfo query = new ChangeLogQueryInfo();
query.From = DateTime.Now.AddDays(-7);
query.Category = new int?(1);
query.Action = (int)ChangeLogPage.ActionType.Publish;
query.MaxRecordsToReturn = 100;
return changeLog.GetChangeCountBackwards(query);

Any suggestions?

Leon Radley
  • 7,596
  • 5
  • 35
  • 54

1 Answers1

0

Silly question but is the change log enabled?

Have you tried

IList<IChangeLogItem> list = changeLog.GetChanges(query, ReadDirection.Backwards, SortOrder.Descending);

Do you get any results?

Also it's worth noting that using the change log is unsupported

tompipe
  • 949
  • 6
  • 8
  • I'm using the new RecentlyChangedPagesFinder().Find(Count); This uses the changelog under the hood. but that only supports getting the last N number of pages. I want to get a count of all pages changed in the last week. – Leon Radley Jan 12 '12 at 07:37
  • Have you looked at the report centre or online centre? There is a report for recently changed pages and a gadget in online center. You could either use that in itself, or the code within it as a starter. The template for the report is in the following directory C:\Program Files (x86)\EPiServer\CMS\[Version]\Application\UI\CMS\Report\Reports The gadget is MVC, the views are within the following directory: C:\Program Files (x86)\EPiServer\CMS\[Version]\Application\UI\EPiServer\CMS\Views\RecentlyChangedPages You will need a disassembler such as reflector to look at the underlying code – tompipe Jan 12 '12 at 14:15