VSTO - Outlook - Unload addin



I have written an addin for Outlook 2003 using VS.net 2005, VSTO, and

In "ThisApplication_Startup" I perform several tests to see if the
addin should load for the current user. If the addin should not load,
how do I unload the addin without shutting down outlook? I keep seeing
things that say you can shut down the addin's app domain, but I have
not seen code that says how to get the addin's app domain. If this is
how you are supposed to do it could someone give me a code snippet to
accomplish this? If there is a better way could someone please let me
know what it is?

For example, using VS.NET 2003 and C#, you could do the following to
unload the addin programatically:

Marshal.ReleaseComObject (m_AddInInstance);
Marshal.ReleaseComObject (m_OutlookApplicationObject);

Obviously that code doesn't work with VS.NET 2005, C#, and VSTO. But
there has to be some way to programmatically unload an addin in its
"ThisApplication_Startup" method. There are too many scenarios where
this is important for it to have been left out (for example: licensing
and error handling)

Thank you very much
Kelly Johnson

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question