views:

316

answers:

1

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

A: 

I'm running into this very same thing. If someone closes Outlook while I have a reference to it using OLE Automation, I get "RPC Server is Unavailable". In Outlook 2000, when a user closed Outlook, it would remain running, just hidden. Outlook 2000 wouldn't close until my application released its references.

Troy