Adds the specified certificate to the store.
true if certificate was successfully added to the store; otherwise, false.
| Exception Type | Condition |
|---|---|
| MailBeeInvalidArgumentException | cert is a null reference (Nothing in Visual Basic). |
| MailBeeCertificateStoreWin32Exception | Win32 returned an error on attempt to add the certificate to the store and ThrowExceptions is true. |
This sample registers a new certificate store, reads a certificate from a file and adds this certificate to the newly created store.
[C#] // 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);
[Visual Basic] ' To use the code below, import MailBee namespace at the top of your code Imports MailBee.Security CertificateStore.RegisterSystemStore("TestStore", RegistryStoreLocation.CurrentUser) Dim store As CertificateStore = New CertificateStore("TestStore", CertStoreType.System, Nothing) Dim cert As Certificate = New Certificate("C:\Temp\test.cer", CertFileType.Cer, Nothing) store.AddCertificate(cert, True)
CertificateStore Class | MailBee.Security Namespace | AddCertificates