Compartilhar via


SPSite.Quota Property

Gets or sets a quota for the site collection.

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

Syntax

'Declaration
<SubsetCallableExcludeMemberAttribute(SubsetCallableExcludeMemberType.UnsupportedSPType)> _
Public Property Quota As SPQuota
    Get
    Set
'Usage
Dim instance As SPSite
Dim value As SPQuota

value = instance.Quota

instance.Quota = value
[SubsetCallableExcludeMemberAttribute(SubsetCallableExcludeMemberType.UnsupportedSPType)]
public SPQuota Quota { get; set; }

Property Value

Type: Microsoft.SharePoint.Administration.SPQuota
An SPQuota object that represents the quota.

Examples

The following code example uses the Quota property to apply a quota template to a site collection on the specified virtual server.

Dim uriNew As New Uri("http://Server_Name")
Dim oWebApp As SPWebApplication = SPWebApplication.Lookup(uriNew)

Using oSiteCollection As SPSite = oWebApp.Sites("http://Site_Name")
    oSiteCollection.Quota = SPWebService.ContentService.QuotaTemplates("Quota_Template_Name")
End Using
Uri uriNew = new Uri("http://Server_Name"); 
SPWebApplication oWebApp = SPWebApplication.Lookup(uriNew);

using(SPSite oSiteCollection = oWebApp.Sites["http://Site_Name"])
{
    oSiteCollection.Quota = SPWebService.ContentService.QuotaTemplates["Quota_Template_Name"]; 
}

Note

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.

See Also

Reference

SPSite Class

SPSite Members

Microsoft.SharePoint Namespace