Gets information about site usage, including bandwidth, storage, and number of visits to the site collection.
命名空间: Microsoft.SharePoint
程序集: Microsoft.SharePoint(位于 Microsoft.SharePoint.dll 中)
语法
声明
Public ReadOnly Property Usage As SPSite.UsageInfo
Get
用法
Dim instance As SPSite
Dim value As SPSite.UsageInfo
value = instance.Usage
public SPSite.UsageInfo Usage { get; }
属性值
类型:Microsoft.SharePoint.SPSite.UsageInfo
An SPSite.UsageInfo structure that contains the usage information.
示例
The following code example iterates through all the site collections in a Web application and displays the URL and amount of storage used in each.
Dim uriNew As New Uri("http://MyServer")
Dim oWebApp As SPWebApplication = SPWebApplication.Lookup(uriNew)
Dim collSiteCollection As SPSiteCollection = oWebApp.Sites
For Each oSiteCollection As SPSite In collSiteCollection
Dim oUsageInfo As SPSite.UsageInfo = oSiteCollection.Usage
Dim lngStorageUsed As Long = oUsageInfo.Storage
Response.Write(("Site Collection URL: " + oSiteCollection.Url + " Storage: " + lngStorageUsed.ToString() + "<BR>"))
oSiteCollection.Dispose()
Next oSiteCollection
Uri uriNew = new Uri("http://MyServer");
SPWebApplication oWebApp = SPWebApplication.Lookup(uriNew);
SPSiteCollection collSiteCollection = oWebApp.Sites;
foreach (SPSite oSiteCollection in collSiteCollection)
{
SPSite.UsageInfo oUsageInfo = oSiteCollection.Usage;
long lngStorageUsed = oUsageInfo.Storage;
Response.Write("Site Collection URL: " + oSiteCollection.Url +
" Storage: " + lngStorageUsed.ToString() + "<BR>");
oSiteCollection.Dispose();
}
备注
Certain objects implement the IDisposable interface, and you must avoid retaining these objects in memory after they are no longer needed. For information about good coding practices, see Disposing Objects.