How to open Outlook new mail window when Outlook is already open?

-1

I want to send an email programmatically from C#/WPF.
I tried some code but works only if Outlook is closed, else it get me this exception at the first line of code:

La récupération de la fabrique de classes COM pour le composant avec le CLSID {0006F03A-0000-0000-C000-000000000046} a échoué en raison de l'erreur suivante : 80080005 Échec de l’exécution du serveur (Exception de HRESULT : 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).

This is what I tried as a code:

Outlook.Application oApp = new Outlook.Application ();
Outlook._MailItem oMailItem = (Outlook._MailItem)oApp.CreateItem ( Outlook.OlItemType.olMailItem );
oMailItem.To    = address;
// body, bcc etc...
oMailItem.Display ( true );

I found some solutions but for VBA not C#:
Outlook mail automation - error only when Outlook is already running

c#
wpf
email
outlook
asked on Stack Overflow Sep 26, 2019 by Kate

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0