I'm developing an Outlook 2007/2010 plugin in VSTO (the project is for 2007, but works also with 2010). This application works with certificates (the System.Security.Cryptography.X509Certificates.X509Certificate
class), which are handling some time after initialization (in other threads); I suspect this may be the reason for the ComException.
When I try to create a new Outlook object (e.g. mail/note/task) I get a ComException - sometimes with the error code
HRESULT: 0x800401E3 (MK_E_UNAVAILABLE)
outlookApp = new Microsoft.Office.Interop.Outlook.Application();
var note = (Microsoft.Office.Interop.Outlook.NoteItem)outlookApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olNoteItem);
The same exception happens when I try to get Outlook with other ways (e.g. marshall or CreateObject("Outlook.Application")
).
Note that immediately after application start everything works fine, so what's wrong? If it is something with certificates, is there a way to add an object to Outlook by another way, avoiding this error?