共用方式為


SPServiceContext.GetContext Method (SPSite)

Gets the service context for the specified SPSite object.

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

Syntax

'Declaration
Public Shared Function GetContext ( _
    site As SPSite _
) As SPServiceContext
'Usage
Dim site As SPSite
Dim returnValue As SPServiceContext

returnValue = SPServiceContext.GetContext(site)
public static SPServiceContext GetContext(
    SPSite site
)

Parameters

Return Value

Type: Microsoft.SharePoint.SPServiceContext
An SPServiceContext object for the specified site.

Remarks

If site is null, GetContext(SPSite) returns null.

See Also

Reference

SPServiceContext Class

SPServiceContext Members

GetContext Overload

Microsoft.SharePoint Namespace