Wednesday, September 24, 2008

Getting the site usage information

Scenario:
You want to get the basic site usage information

Solution:
You can get the basic site usage information using UsageInfo structure of site.

Code:

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;
Article:
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsite.usageinfo.aspx

0 comments: