Clase de CallerImpersonationScope

Se aplica a: CRM 2015 on-prem, CRM Online

Identifies a user as the owner of all data changes made by calls to a Web service.

Espacio de nombres: Microsoft.Xrm.Sdk
Ensamblado: Microsoft.Xrm.Sdk (en Microsoft.Xrm.Sdk.dll)

Sintaxis

'Declaración
Public NotInheritable Class CallerImpersonationScope
    Implements IDisposable
public sealed class CallerImpersonationScope : IDisposable

Comentarios

The specified user does not have to be the same user that instantiated the service. When the CallerImpersonationScope object goes out of scope and is disposed, calls to the service are owned by the original user that instantiated the service.

using (new CallerImpersonationScope(service, userId))
{
   // Display information about the logged on user.
   Guid effectiveUserId = ((WhoAmIResponse)service.Execute(new WhoAmIRequest())).UserId;
   SystemUser systemUser = (SystemUser)service.Retrieve("systemuser", effectiveUserId, 
       new ColumnSet(new string[] {"firstname", "lastname"}));
   Console.WriteLine("Logged on user is {0} {1}.", systemUser.FirstName, systemUser.LastName);
}

Jerarquía heredada

System.Object
  Microsoft.Xrm.Sdk.CallerImpersonationScope

Seguridad de hilo

Los miembros estáticos públicos (Shared en Visual Basic) de este tipo son seguros para el hilo. No se garantiza que los miembros de instancia sean seguros para el hilo.

Plataformas

Plataformas de desarrollo

Windows Vista, Windows Server 2003 y

Plataformas de destino

Windows Vista,Windows XP

Change History

Vea también

Referencia

Miembros de CallerImpersonationScope
Espacio de nombres de Microsoft.Xrm.Sdk

Otros recursos

Impersonate Another User

Send comments about this topic to Microsoft.
© 2014 Microsoft Corporation. All rights reserved.