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.