ImpersonateUser method

Sets the user context to a new user. This method can be called on the object only once, and returns an INVALID_OPERATION error if it is already called.

By using the eRoom user context object and calling ::ImpersonateUser() method, you can temporarily establish a user context as another eRoom user.  

Note: The eRoom user context is stored on the execution thread. There may be cases where this context is cached on storage objects that are retrieved while the user context is active. For this reason, we recommend that you get interfaces after user impersonation to ensure predictable behavior. For example, in a custom command, call ::ImpersonateUser() and then get interfaces from the IERUUserContext object.

Syntax


C++

HRESULT ImpersonateUser (
   VARIANT User,
   ERUParameterType ParamType)

Scripting languages

UserContext.ImpersonateUser (
   User as Variant,
   ParamType as ERUParameterType)

Parameters


User

The loginname or ID of the user.  If you specify the erParamTypeID member of the ERUParameterType enum, then the user parameter is a user ID. Otherwise, it is a loginname.

ParamType

Optional type of the User parameter. (By default, a loginname, unless you specify theerParamTypeID member of the ERUParameterType enum.)

Return value


C++

The return code.

Scripting languages

None.

Home

Applies to

IERUUserContext