Share via


SPIdentityContext.Impersonate method

Impersonates the [SPIdentityContext] application and user identity on the current thread.

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

Syntax

'Declaration
Public Function Impersonate As IDisposable
'Usage
Dim instance As SPIdentityContext
Dim returnValue As IDisposable

returnValue = instance.Impersonate()
public IDisposable Impersonate()

Return value

Type: System.IDisposable
An [IDisposable] interface that represents the impersonation context.

Remarks

The returned interface must be disposed on the same thread where the [Impersonate] method was invoked, in order to restore the previous thread application and user identity.

See also

Reference

SPIdentityContext class

SPIdentityContext members

Microsoft.SharePoint.IdentityModel namespace