Group:  Microsoft Outlook ยป microsoft.public.outlook.program_addins
Thread: Releasing COM Components

Geek News

Releasing COM Components
Nenad Dobrilovic 10/10/2008 11:58:01 AM
I have created programmatically a structure of root MAPIFolder, with
subfolders and MailItems.

Is it necessary to explicitly release all items (subfolders and mail items)
or I can release only the root MAPIFolder?
--
Nenad Dobrilovic
Re: Releasing COM Components
"Ken Slovak - [MVP - Outlook]" <kenslovak[ at ]mvps.org> 10/10/2008 1:09:53 PM
Best practice is to always release everything.

Since you provide no information about your development language or platform
or even the Outlook versions you're targeting it's impossible to say more.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Nenad Dobrilovic" <NenadDobrilovic[ at ]discussions.microsoft.com> wrote in
message news:14721A9F-5CE7-4E5C-84CA-453F4CFCF27E[ at ]microsoft.com...
[Quoted Text]
>I have created programmatically a structure of root MAPIFolder, with
> subfolders and MailItems.
>
> Is it necessary to explicitly release all items (subfolders and mail
> items)
> or I can release only the root MAPIFolder?
> --
> Nenad Dobrilovic

Re: Releasing COM Components
Nenad Dobrilovic 10/10/2008 1:49:02 PM
Thank you.
I am using C# and VSTO to make an add-in for Outlook 2003.
--
Nenad Dobrilovic


"Ken Slovak - [MVP - Outlook]" wrote:

[Quoted Text]
> Best practice is to always release everything.
>
> Since you provide no information about your development language or platform
> or even the Outlook versions you're targeting it's impossible to say more.
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Professional Programming Outlook 2007.
> Reminder Manager, Extended Reminders, Attachment Options.
> http://www.slovaktech.com/products.htm
>
>
> "Nenad Dobrilovic" <NenadDobrilovic[ at ]discussions.microsoft.com> wrote in
> message news:14721A9F-5CE7-4E5C-84CA-453F4CFCF27E[ at ]microsoft.com...
> >I have created programmatically a structure of root MAPIFolder, with
> > subfolders and MailItems.
> >
> > Is it necessary to explicitly release all items (subfolders and mail
> > items)
> > or I can release only the root MAPIFolder?
> > --
> > Nenad Dobrilovic
>
>
Re: Releasing COM Components
"Ken Slovak - [MVP - Outlook]" <kenslovak[ at ]mvps.org> 10/10/2008 2:50:07 PM
In that case in addition to setting all COM objects to null in the
procedures where you declare them you should also use
Marshal.ReleaseComObject() on them if you no longer need the objects or any
other related objects.

For example, if you have a locally declared Inspector object don't use
Marshal.ReleaseComObject() on it if you still need other instances of that
object anywhere in your code. Otherwise you get an RCW error when you try to
refer to the Inspector in other parts of your code.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Nenad Dobrilovic" <NenadDobrilovic[ at ]discussions.microsoft.com> wrote in
message news:BB118A2D-02D2-4577-A2A8-6C560882C9BA[ at ]microsoft.com...
[Quoted Text]
> Thank you.
> I am using C# and VSTO to make an add-in for Outlook 2003.
> --
> Nenad Dobrilovic

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net