Platform SDK: Certificate Enrollment Control

ICEnroll2::addCertTypeToRequest [C++]

CEnroll.addCertTypeToRequest [Visual Basic]

This method is used to add a certificate template to a request. This method is associated with the Microsoft Certificate Services enterprise Policy Module. This method is an advanced topic and its use is not recommended for most applications.

The phrase 'certificate type' is synonymous with 'certificate template'.

[Visual Basic]
objEnroll.addCertTypeToRequest( _
            CertType As String )
[C++]
HRESULT addCertTypeToRequest(
  BSTR CertType    // in
);

Parameters

[Visual Basic] objEnroll
Object expression that resolves to a CEnroll object.
[Visual Basic,C++] CertType
The certificate template fully qualified name which is being added to the certificate request; this value is interpreted by the certification authority.

Return Values

[Visual Basic] None.

[C++] The return value is an HRESULT, with S_OK returned if the call is successful.

Remarks

This method can be called multiple times if more than one certificate template is desired for the request.

Example Code [C++]

BSTR    bstrCertType = NULL;
HRESULT hr;

// allocate BSTR for the certificate template
bstrCertType = SysAllocString(L"Machine");

// add the certificate template to the request
// pEnroll is previously instantiated ICEnroll2 interface pointer
hr = pEnroll->addCertTypeToRequest( bstrCertType );

if ( FAILED( hr ) )
    printf("Failed addCertTypeToRequest - %x\n", hr );
else
    printf("addCertTypeToRequest(%ws) succeeded\n", bstrCertType );

// free BSTR
if ( NULL != bstrCertType )
    SysFreeString( bstrCertType );

Example Code [Visual Basic]

' declare Certificate Enrollment Control object
Dim objXen As Object

' variable to contain Cert Template
Dim strCertType As String

' instantiate the object
Set objXen = CreateObject("CEnroll.CEnroll.1")

' add a cert type to the request
strCertType = "Machine"
objXen.addCertTypeToRequest strCertType

Requirements

  Windows NT/2000: Requires Windows 2000.
  Header: Declared in Xenroll.h.
  Library: Use Uuid.lib.