SPContext.Current property
Obtém o contexto da solicitação HTTP atual em Microsoft SharePoint Foundation.
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'Declaração
Public Shared ReadOnly Property Current As SPContext
Get
'Uso
Dim value As SPContext
value = SPContext.Current
public static SPContext Current { get; }
Property value
Type: Microsoft.SharePoint.SPContext
O contexto de SharePoint Foundation .
Comentários
A propriedade Current fornece propriedades que acessarem vários objetos dentro do contexto atual do SharePoint Foundation , por exemplo, a lista atual, site, conjunto de sites ou aplicativo da Web.
Examples
O exemplo a seguir usa a propriedade Current para acessar a coleção de conjuntos de sites do aplicativo Web atual.
Dim myApp As SPWebApplication = SPContext.Current.Site.WebApplication
Dim sites As SPSiteCollection = myApp.Sites
Dim site As SPSite
For Each site In sites
Response.Write((site.Url + "<BR>"))
Next site
SPWebApplication oWebApplicationCurrent = SPContext.Current.Site.WebApplication;
SPSiteCollection collSites = oWebApplicationCurrent.Sites;
foreach (SPSite oSite in collSites)
{
Response.Write(oSite.Url + "<BR>");
oSite.Dispose();
}