CertificateStoreAddCertificates Method |
Adds all the certificates from the specified collection to the store.
Namespace: MailBee.SecurityAssembly: MailBee.NET (in MailBee.NET.dll) Version: 12.5.0 build 687 for .NET 4.5
Syntax public bool AddCertificates(
CertificateCollection certs,
bool overwrite
)
Public Function AddCertificates (
certs As CertificateCollection,
overwrite As Boolean
) As Boolean
Parameters
- certs
- Type: MailBee.SecurityCertificateCollection
The collection of the certificates to be added to the store. - overwrite
- Type: SystemBoolean
Sets whether the same certificates should be overwritten if they already exist in the store.
Return Value
Type:
Booleantrue if the certificates were successfully added to the store; otherwise,
false.
Exceptions Remarks If this method successfully added at least one certificate from the collection and then failed while
adding the next certificate, those certificates which have already been added will remain in the store.
In other words, adding multiple certificates is not a single transaction.
Examples This sample creates a special store and fills it with the certificates belonging to
user@domain.com entity and saves this store to disk.
using MailBee.Security;
CertificateStore newStore = new CertificateStore("", CertStoreType.Memory, null);
CertificateStore myStore = new CertificateStore(CertificateStore.Personal, CertStoreType.System, null);
CertificateCollection coll = myStore.FindCertificates("user@domain.com", CertificateFields.EmailAddress);
newStore.AddCertificates(coll, false);
newStore.SaveToFile(@"C:\Temp\store.sst", CertStoreFileType.Sst, null);
Imports MailBee.Security
Dim newStore As CertificateStore = New CertificateStore("", CertStoreType.Memory, Nothing)
Dim myStore As CertificateStore = New CertificateStore(CertificateStore.Personal, CertStoreType.System, Nothing)
Dim coll As CertificateCollection = myStore.FindCertificates("user@domain.com", CertificateFields.EmailAddress)
newStore.AddCertificates(coll, False)
newStore.SaveToFile("C:\Temp\store.sst", CertStoreFileType.Sst, Nothing)
See Also