IX509CertificateTemplateWritable::Commit method (certenroll.h)
The Commit method deletes a template from or saves it to Active Directory.
Syntax
HRESULT Commit(
[in] CommitTemplateFlags commitFlags,
[in] BSTR strServerContext
);
Parameters
[in] commitFlags
A CommitTemplateFlags enumeration value that specifies how to save or delete the template. This must be one of the following values.
[in] strServerContext
A BSTR variable that contains the DNS name of the Active Directory server to which the changes will be applied. If this value is NULL, the changes will be applied to the default domain controller.
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 |
---|---|
|
CommitFlagSaveTemplateGenerateOID was specified in the commitFlags argument but a template with a matching common name or a matching object identifier (OID) already exists. |
|
CommitFlagDelete was specified in the commitFlags argument and a template with the same Common Name was found but the OID did not match. |
|
The caller does not have the appropriate permission to save or delete a template. The caller must have write and delete permission on the template container and template objects in Active Directory. If the caller has delete permission on the template container and objects but does not have delete permission on the OID container and objects, the template will be deleted but the OID will not be. |
|
Either CommitFlagSaveTemplateUseCurrentOID or CommitFlagSaveTemplateOverwrite was specified in the commitFlags argument. These values are not currently used. |
|
CommitFlagDelete was specified in the commitFlags argument but a template having a matching Common Name (CN) could not be found. |
|
The Commit method is not supported for default templates. |
|
The IX509CertificateTemplateWritable object has not been initialized. |
Remarks
When CommitFlagSaveTemplateGenerateOID is specified in the commitFlags argument, this method will not succeed unless the template and OID containers have already been created. These containers can be created in any of the following ways:
- Installing an enterprise certification authority on the server.
- Launching the Certtmpl.msc snap-in.
- Using the Certutil.exe -installDefaultTemplates command to install the default templates.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 7 [desktop apps only] |
Minimum supported server | Windows Server 2008 R2 [desktop apps only] |
Target Platform | Windows |
Header | certenroll.h |