outlookoutlook-object-model

How can I avoid "RPC Server is unavailable" when a user closes Outlook, and my app is using OLE Automation?


My application uses the Outlook object model. Outlook is an out-of-process COM server. Before Outlook 2007, if the user would close Outlook while my app had a reference to it, Outlook would stay running in a hidden state. In Outlook 2007, if the user closes Outlook, the process closes and my application receives a "RPC server is unavailable". Outlook is ignoring my apps reference.

How do I get Outlook 2007 to respect my application's reference to it, and do what it used to do in Outlook 2000 (stay running until my app released the reference)?


Solution

  • Subscribe to the Quit event off the application object and release your references to outlook etc.

    I think there is also a reg hack to make it behave as before ..

    arrha .. just found the msdn article with the registry path http://msdn.microsoft.com/en-us/library/dd239276.aspx