CertificateStoreAddCertificates Method
Adds all the certificates from the specified collection 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 AddCertificates(
	CertificateCollection certs,
	bool overwrite
)

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: Boolean
true if the certificates were successfully added to the store; otherwise, false.
Exceptions
ExceptionCondition
MailBeeInvalidArgumentExceptioncerts is a null reference (Nothing in Visual Basic).
MailBeeCertificateStoreWin32ExceptionWin32 returned an error on attempt to add any of the certificates to the store and ThrowExceptions is true.
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.
// To use the code below, import MailBee namespace at the top of your code
using MailBee.Security;

// The actual code (put it into a method of your class).
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);
See Also