Provides fields used to access information regarding site collection usage.
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No
The Storage and DiscussionStorage fields contain data that is updated in real time; data for the Bandwidth field, Hits field, and Visits field is updated daily by the usage analysis timer job. The usage analysis timer job produces an aggregate summary of data in the site collection and reports only data contained in the HTTP logs. The HTTP log reports most operations, but it does not report requests for files in the _layouts directory.
The following code example uses the UsageInfo structure to gather usage information about the current site collection.
SPSite oSiteCollection = SPContext.Current.Site; SPSite.UsageInfo oUsageInfo = oSiteCollection.Usage; Int64 int64DiscussionStorage = oUsageInfo.DiscussionStorage; Int64 int64Storage = oUsageInfo.Storage; Int64 int64Bandwidth = oUsageInfo.Bandwidth; Int64 int64Hits = oUsageInfo.Hits; Int64 int64Visits = oUsageInfo.Visits;