Outlook MAPI session exception when outlook interface is closed

Posted by michele on Stack Overflow See other posts from Stack Overflow or by michele
Published on 2009-08-26T13:22:16Z Indexed on 2010/05/05 13:28 UTC
Read the original article Hit count: 404

Filed under:
|
|
|

I'm developing a email sender that retrieve data from a database, build up a MailItem with the Outlook Interop and send it.

My email sender is running by a windows service that is notified everytime there's some data to send. I'm logging on the MAPI session of Outlook without problem and everything seems to work.

But...

when someone open Outlook interface and then close, my service crash at the first attempt i call a SendAndReceive method, with an exception that report that the session is assigned to another thread.

I'm googling around for hours and i'm listening to the application_quit event, raised by the interface closing, trying to logoff and logon again to the application...but i'm still falling in the same error.

Where am i wrong?Any suggestion?

Thank you in advance

© Stack Overflow or respective owner

Related posts about outlook

Related posts about interop