GetUsageData(Microsoft.SharePoint.Administration.SPUsageReportType, Microsoft.SharePoint.Administration.SPUsagePeriodType) Method
The GetUsageData method of the SPWeb class returns a table that contains information about the usage of a Web site based on the specified type of report and time interval.
Parameters
itemType A Microsoft.SharePoint.Administration.SPUsageReportType value that specifies the type of report to be created.
periodType A Microsoft.SharePoint.Administration.SPUsagePeriodType value that specifies the time interval to use in the information returned.
Return Value
A System.Data.DataTable object that contains the information.
Remarks
The GetUsageData method returns only 2000 records from the usage data for the site, while the GetUsageBlob method of Remote Procedure Call (RPC) protocol returns all usage data. For general information about usage event logging, see Usage Event Logging in Windows SharePoint Services.
Example
The following code example populates a DataGrid control with information about the number of hits by type of browser that a Web site received during the last month.
This example requires using directives (Imports in Visual Basic) for the Microsoft.SharePoint, Microsoft.SharePoint.Administration, and Microsoft.SharePoint.WebControls namespaces.
Requirements
Platforms: Microsoft Windows Server 2003
Security: Code Access Security