MAPIFolder Object

Microsoft Outlook Visual Basic

Show All

MAPIFolder Object

         
Multiple objects MAPIFolder
Multiple objects

Represents a Microsoft Outlook folder. A MAPIFolder object can contain other MAPIFolder objects, as well as Outlook items. You can navigate nested folders by using a combination of Folders(index), which returns a folder within a name space or another folder, and the Parent property, which returns the containing object.

Using the MAPIFolder Object

Use Folders(index), where index is the name or index number, to return a single MAPIFolder object from a NameSpace object or another MAPIFolder object.

There is a set of folders within an Outlook data store that support the default functionality of Outlook. Use GetDefaultFolder(index), where index is one of the OlDefaultFolders constants to return one of the default Outlook folders in the Outlook NameSpace object. The OlDefaultFolders constants are olFolderCalendar, olFolderContacts, olFolderDeletedItems, olFolderDrafts, olFolderInbox, olFolderJournal, olFolderNotes, olFolderOutbox, olFolderSentMail, and olFolderTasks.

Use the Add method to add a folder to the Folders object. The Add method has an optional argument that can be used to specify the type of items that can be stored in that folder. By default, folders created inside another folder inherit the type of the parent folder.

Folders within the Outlook data store can be typed; for example, the Calendar folder will only contain AppointmentItem objects and the Contacts folder will only contain ContactItem and DistListItem objects.

Note that when items of a specific type are saved, they are saved directly into their corresponding default folder. For example, when the GetAssociatedAppointment method is applied to a MeetingItem in the Inbox folder, the appointment that is returned will be saved to the default Calendar folder.