CertificateStoreAddCertificate Method
Adds the specified certificate to the store.

Namespace: MailBee.Security
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.5.0 build 687 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. Ignored in .NET Standard 2.0 edition.

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.
MailBeeCertificateExceptionCryptographicException occurred and ThrowExceptions is true.
Remarks
Starting from .NET Standard 2.0 edition, this method is just a wrapper around Add(X509Certificate2) method.
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