SPContext.Site Property

Gets the site collection that is associated with the current Microsoft SharePoint Foundation request context. Used in conjunction with the static Current property.

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

Syntax

'Declaration
<ClientCallableAttribute(Name := "Site")> _
<ClientCallableConstraintAttribute(Type := ClientCallableConstraintType.NotNull)> _
Public ReadOnly Property Site As SPSite
    Get
'Usage
Dim instance As SPContext
Dim value As SPSite

value = instance.Site
[ClientCallableAttribute(Name = "Site")]
[ClientCallableConstraintAttribute(Type = ClientCallableConstraintType.NotNull)]
public SPSite Site { get; }

Property Value

Type: Microsoft.SharePoint.SPSite
The site collection of the current request context.

Remarks

Use SPContext.Current.Site to get the site collection of the current request context.

See Also

Reference

SPContext Class

SPContext Members

Microsoft.SharePoint Namespace