Markus Frischholz
6/1/2007 4:25:00 PM
I try to extend a managed .NET 2.0 client/server application which connects
to a Oracle database with an e-mail feature. Since my clients would like to
use the Outlook address book I decided to use CDO 1.2.1.
The problem is that if a Oracle connection is opened prior to the e-mail
send function the send function throws a MAPI_E_NOT_INITIALIZED(80040605)
exception. This is the case with the Microsoft Oracle .NET client as well as
the Oracle ODP.NET client. SqlServer and OleDB don't have this problem.
The e-mail function works fine if the Oracle connection is not opened prior
to this.
This is driving me crazy. I tried to experiement with seperate threads but
nothing seams to help.
------------------------------------------------------
using System.Data.OracleClient;
using MAPI;
[STAThread]
static void Main() {
OracleConnection con = new OracleConnection("...");
con.Open();
con.Close();
Session session = new Session();
session.Logon(Type.Missing, Type.Missing, true, false, Type.Missing,
Type.Missing, Type.Missing);
Folder outbox = (Folder)session.Outbox;
Messages outboxMessages = (Messages)outbox.Messages;
Message message = (Message)outboxMessages.Add("Test Message", "Hello
World", Type.Missing, Type.Missing);
message.Send(true, true, Type.Missing); // throws MAPI_E_NOT_INITIALIZED
}
-----------------------------------------------------------
Any help and support is appreciated.