When trying to run this code, I get the following error message :
Unhandled Exception: System.Runtime.InteropServices.COMException
(0x80010106): Cannot change thread mode after it is set.
1. Anyone an idea why ?
2.Does anyone knows a better way than CDO to connect a mailbox on a
Exchange 5.5 server ?
Thanks
using System;
using System.Threading;
namespace MailConnections
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
Class1 c1 = new Class1();
Thread t1 = new Thread(new ThreadStart(c1.connect));
//c1.connect(); //works perfect
t1.Start();
Console.ReadLine();
}
public void connect()
{
MAPI.Session session = new MAPI.Session();
Console.WriteLine("Session created");
}
}
}