Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Outlook 2003 and Outlook 2007 Plug-in COM Resources release

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.

like image 571
Koekiebox Avatar asked Nov 06 '22 10:11

Koekiebox


1 Answers

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.

like image 191
Eric Brown Avatar answered Nov 15 '22 15:11

Eric Brown