4

I am trying to display some SharePoint usage data in a web part.

Here's my code:

SPSite spSiteCollection = new SPSite(myURL)
spSiteCollection.CatchAccessDeniedException = false;
SPWeb spWeb = spSiteCollection.OpenWeb();

DataTable dtResults = new DataTable();
dtResults = spWeb.GetUsageData(SPUsageReportType.url, SPUsagePeriodType.lastMonth);

The DataTable that is supposed to contain the results is always null. I also tried to run this from an aspx page but nothing.

Alex Angas
  • 59,219
  • 41
  • 137
  • 210

1 Answers1

3

I think before you can retrieve any usage data you have to configure your farm and activate usage reporting.

Flo
  • 27,355
  • 15
  • 87
  • 125
  • i did configure the usage reporting from both the Administration site and the SSP site, also activated the feature in my SharePoint site. –  Sep 02 '09 at 12:47