Platform SDK: Smart Card Enrollment Control

ISCrdEnr::setUserName

The setUserName method specifies the name of the user on whose behalf the certificate enrollment is intended.

objSCEnroll.setUserName (dwFlags As Long, _
                         bstrUserName As String)

Parameters

objSCEnroll
Object expression that resolves to a SCrdEnr object.
dwFlags
This value must be either SCARD_ENROLL_UPN_NAME (defined as 1) or SCARD_ENROLL_SAM_COMPATIBLE_NAME (defined as 2).

Set this value to SCARD_ENROLL_UPN_NAME, if the name specified in bstrUserName is the user's Universal Principal Name, such as "someone@microsoft.com". The user's UPN name must correspond to an existing security access manager (SAM) name.

Set this value to SCARD_ENROLL_SAM_COMPATIBLE_NAME, if the name specified in bstrUserName is the user's SAM name in the format of "DOMAIN\USER".

bstrUserName
Name of the user.

Remarks

Call this method to specify the user name to be issued the smart card. An alternative to setUserName is ISCrdEnr::selectUserName.

Once a user name has been specified, its value can be retrieved by calling getUserName.

Example Code in VBScript

' Define the constants.

Const SCARD_ENROLL_UPN_NAME = 1
Const SCARD_ENROLL_SAM_COMPATIBLE_NAME = 2

' Specify the user name.
Senroll.setUserName SCARD_ENROLL_SAM_COMPATIBLE_NAME, _
                    "DOMAIN1\User1"

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Unsupported.
  Library: Included as a resource in Scrdenrl.dll.

See Also

ISCrdEnr::getUserName, ISCrdEnr::resetUser, ISCrdEnr::selectUserName