IX509EnrollmentHelper::Enroll method (certenroll.h)

The Enroll method enrolls a certificate request and retrieves the issued certificate. This method is web enabled.


  [in]          BSTR               strEnrollmentPolicyServerURI,
  [in]          BSTR               strTemplateName,
  [in]          EncodingType       Encoding,
  [in]          WebEnrollmentFlags enrollFlags,
  [out, retval] BSTR               *pstrCertificate


[in] strEnrollmentPolicyServerURI

A BSTR that contains the certificate enrollment policy server URL.

[in] strTemplateName

A BSTR variable that contains the Common Name (CN) of the template as it appears in Active Directory or the dotted decimal object identifier.

[in] Encoding

An EncodingType enumeration value that specifies the type of encoding applied to a byte array for display purposes.

[in] enrollFlags

A WebEnrollmentFlags enumeration value that specifies web enrollment behavior. This can be the following value.

Value Meaning
If this flag is set and no authentication credential is available for the certificate enrollment server, the certificate service prompts for a credential. If there is no authentication credential and this flag is not set, the Enroll method fails.

[out, retval] pstrCertificate

A BSTR that contains the issued certificate.

Return value

If the function succeeds, the function returns S_OK.

If the function fails, it returns an HRESULT value that indicates the error. Possible values include, but are not limited to, those in the following table. For a list of common error codes, see Common HRESULT Values.

Return code Description
The strEnrollmentPolicyServerURI and strTemplateName parameters cannot be NULL.
The strEnrollmentPolicyServerURI and strTemplateName parameters exceed 64,000 characters or contain embedded null characters.


The Enroll method retrieves the appropriate template, calls InitializeFromTemplate, and then calls Enroll on the IX509Enrollment object.

This method does not installed the issued certificate.


Minimum supported client Windows 7 [desktop apps only]
Minimum supported server Windows Server 2008 R2 [desktop apps only]
Target Platform Windows
Header certenroll.h

See also