Thread: Deleted Items
View Single Post
  #15  
Old March 9th 06, 06:16 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Deleted Items

I would break that up so no implicit object variables are created. In VB 6
syntax:

Dim oNS As Outlook.NameSpace
Dim oFolder As Outlook.MAPIFolder
Dim colItems As Outlook.Items

Set oNS = oOL.GetNameSpace("MAPI")
Set oFolder = oNS.GetDefaultFolder(olFolderContacts)
Set colItems = oFolder.Items

I would explicitly release objects as soon as they are no longer needed. I
would minimize the calls to the garbage collector until they are needed,
perhaps in the shutdown code and whenever you need to ensure that no cached
object references are being maintained.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Rog" wrote in message ...
OK so for example if I get a list of contacts like
GetNamespace("MAPI").GetDefaultFolder(OlDefaultFol ders.olFolderContacts).Items;
and I use it, do I need to release it when I am done with these items?
Also if I say:
object item = GetFolderFromId(entry, store);
do I need to release this item and garbage collect everytime when I am
done with it?
rog


Ads