다음을 통해 공유


SPScenarioContext.GetContext Method

Static method to get the SPScenarioContext object associated with the specified page for the specified culture. If a context object does not yet exist, one is initialized and stored in the session-state object.

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

Syntax

'Declaration
Public Shared Function GetContext ( _
    page As Page, _
    culture As CultureInfo _
) As SPScenarioContext
'Usage
Dim page As Page
Dim culture As CultureInfo
Dim returnValue As SPScenarioContext

returnValue = SPScenarioContext.GetContext(page, _
    culture)
public static SPScenarioContext GetContext(
    Page page,
    CultureInfo culture
)

Parameters

Return Value

Type: Microsoft.SharePoint.Administration.SPScenarioContext
Returns an SPScenarioContext object, newly initialized or retrieved from the session state.

Exceptions

Exception Condition
[ArgumentNullException]

Thrown when page or culture are a null reference (Nothing in Visual Basic).

[ArgumentException]

Thrown when culture is CultureInfo.InvariantCulture.

[SPException]

Thrown when page is not a valid page.

See Also

Reference

SPScenarioContext Class

SPScenarioContext Members

Microsoft.SharePoint.Administration Namespace