views:

303

answers:

3

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.

+2  A: 

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

Flo
i did configure the usage reporting from both the Administration site and the SSP site, also activated the feature in my SharePoint site.
A: 

Hi Idriss Selhoum,

Even i am facing the same problem.have u got any solutions?

suganya
A: 

do you find a solution ?

phil