SPContext.GetContext method (HttpContext, Int32, Type)

Returns the Microsoft SharePoint Foundation context for an item using the specified HTTP context, item ID, and item type.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)


Public Shared Function GetContext ( _
    context As HttpContext, _
    itemId As Integer, _
    itemType As Type _
) As SPContext
Dim context As HttpContext
Dim itemId As Integer
Dim itemType As Type
Dim returnValue As SPContext

returnValue = SPContext.GetContext(context, _
    itemId, itemType)
public static SPContext GetContext(
    HttpContext context,
    int itemId,
    Type itemType


  • context
    Type: System.Web.HttpContext

    A System.Web.HTTPContext object that encapsulates the HTTP-specific context that is used by the server to process site requests.

  • itemId
    Type: System.Int32

    A 32-bit integer that identifies the item.

  • itemType
    Type: System.Type

    A System.Type that represents the type of item.

Return value

Type: Microsoft.SharePoint.SPContext
The SharePoint Foundation context.

See also


SPContext class

SPContext members

GetContext overload

Microsoft.SharePoint namespace