views:

52

answers:

1

Hi All,

I have done my second complete Outlook 2003 Plug-in.

What I want to know is 2 things:

  1. Is it necessary to release the COM Objects when developing a Outlook 2003/2007 Plug-in?

I know that they get released in time by the Framework, what I don't know is how often and is it really necessary?

  1. Why is Microsoft still using .Net COM Wrappers for the Plug-Ins instead of pure .Net.

I am aware of the web service Exchange offers to retrieve mail messages, but one doesn't always want to use that but instead full-on Outlook abilities.

Thanks.

+1  A: 

First - the framework will release the COM objects during garbage collection. If you need the objects released sooner, you can look at this question. However, beware of Marshal.ReleaseComObject - if you don't absolutely need it, don't use it.

Second, Microsoft uses the .NET COM wrappers for two reasons. First, because of legacy code. There are tens of thousands, if not hundreds of thousands, of applications (mostly developed inside corporations, and not for sale) that have plugins and interoperate with Office, and Microsoft doesn't want to break those applications. Second, Office is not a native .NET application, it's a native COM application. The wrappers are there so you can write your plugins in .NET in the first place.

Eric Brown