Access.2007.VBA.Bibl..

(John Hannent) #1
FIGURE 8.16

Outlook Explorer and Inspector objects.


The NameSpace, Explorer, and Inspector objects, in addition to the Application object itself, are
the key to most of the Outlook components you need to work with, such as folders and items. To
work with a folder, for example, you must first set a reference to the Outlook Application object,
then the NameSpace object, and then you can retrieve one of the default local folders using the
GetDefaultFoldermethod, or a custom folder by referencing it as a member of the top-level
Folders collection, or some folder underneath that folder. (Note that the singular of Folders is now
Folder — apparently Microsoft realized that the previous name of MAPIFolder was causing confusion.)

Although the MAPIFolder object has been replaced with the more intuitive Folder
object in the Object Browser, you can still declare a folder object as MAPIFolder with-
out causing a compile error. This means you don’t need to go through all your old Outlook code and
change MAPIFolder declarations to Folder.

Syntax for Referencing Outlook Objects ..................................................................


The Items collection for a Folder represents all the separate Outlook items in that folder, which
may be of different types. There is no such thing as a singular Item object in Outlook — a pitfall
that has caught many beginning Outlook programmers. Thus when you need to work with items

NOTENOTE


Working with Outlook Items 8

Free download pdf