CertificateStoreAddCertificate Method
Adds the specified certificate to the store.

Namespace: MailBee.Security
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 11.2.0 build 590 for .NET 4.5
Syntax
public bool AddCertificate(
	Certificate cert,
	bool overwrite
)

Parameters

cert
Type: MailBee.SecurityCertificate
The certificate that should be added.
overwrite
Type: SystemBoolean
Sets whether the same certificate (if it already exists in the store) should be overwritten or not.

Return Value

Type: Boolean
true if certificate was successfully added to the store; otherwise, false.
Exceptions
ExceptionCondition
MailBeeInvalidArgumentExceptioncert is a null reference (Nothing in Visual Basic).
MailBeeCertificateStoreWin32ExceptionWin32 returned an error on attempt to add the certificate to the store and ThrowExceptions is true.
Examples
This sample registers a new certificate store, reads a certificate from a file and adds this certificate to the newly created store.
// To use the code below, import MailBee namespace at the top of your code
using MailBee.Security;

CertificateStore.RegisterSystemStore(@"TestStore", RegistryStoreLocation.CurrentUser);
CertificateStore store = new CertificateStore(@"TestStore", CertStoreType.System, null);
Certificate cert = new Certificate(@"C:\Temp\test.cer", CertFileType.Cer, null);
store.AddCertificate(cert, true);
See Also