共用方式為


SPSite.UsageInfo Structure

Provides fields used to access information regarding site collection usage.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No

Syntax

'Declaration
Public Structure UsageInfo
'Usage
Dim instance As SPSite.UsageInfo
public struct UsageInfo

Remarks

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.

Examples

The following code example uses the UsageInfo structure to gather usage information about the current site collection.

Dim siteCollection As SPSite = SPControl.GetContextSite(Context)
Dim uInfo As SPSite.UsageInfo = siteCollection.Usage

Dim discussionStorage As Int64 = uInfo.DiscussionStorage
Dim storage As Int64 = uInfo.Storage
Dim discussionStorage As Int64 = uInfo.Bandwidth
Dim hits As Int64 = uInfo.Hits
Dim visits As Int64 = uInfo.Visits
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;

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

SPSite.UsageInfo Members

Microsoft.SharePoint Namespace