an error about System.Runtime.InteropServices.Marshal.ReleaseComObject(rules);

Jul 9, 2011 at 12:25 PM

Hello,

I want to remove a outlook rule with following code, but i get an error but no error in Microsoft.Office.Interop.Outlook

System.Runtime.InteropServices.Marshal.ReleaseComObject(rules);

 error :

Message=The object's type must be __ComObject or derived from __ComObject.

 

Coordinator
Jul 9, 2011 at 12:54 PM

what the hell you doing? :o
ReleaseComObject release a COM proxy, you dont remove anything in outlook with this(btw: i dont know what is a rule in outlook)
the method awaits a com proxy but NetOffice wraps COM proxies for you in wrapper classes and gives you a smarter way to release: rule.Disose();
please read:
http://netoffice.codeplex.com/wikipage?title=Tec_Documentation_English_Management
and take a look at the tutorials.

regards
Sebastian

Jul 9, 2011 at 2:01 PM

Hello,

       Thank you very much ,i can remove a outlook rule.

       Pls open Outlook client such Outlook 2007 ,Outlook -- Tools -- Rules and Alerts..,you can see the Outlook rule. ^_^

 

BR.

dxdnj