October 25, 2016
Hot Topics:

Outlook 2000 VBA Programmers Reference

  • November 19, 2002
  • By Dwayne Gifford
  • Send Email »
  • More Articles »

Application Property

The Application property will return the parent application object of the MAPIFolder object. This will be the Outlook Application object.

Set ApplicationObject = MAPIFolderObject.Application

Class Property

The Class property returns a unique value that identifies the object’s type. This will be one of the OlObjectClass constants and in this case will be olFolder or 2.

Long = MAPIFolderObject.Class

DefaultItemType Property

The DefaultItem property returns the default item type for the MAPIFolder. This property specifies what type of Outlook item a folder possesses by default, i.e. if you create a new item without supplying the Type then its type will be set according to the DefaultItemType of the folder it is added to.

Long = MAPIFolderObject.DefaultItemType

The value returned will be one of the following OlItemType contants:

Constant Value Description
olAppointmentItem 1 An Appointment item
olContactItem 2 A Contact item
olJournalItem 4 A Journal item
olMailItem 0 A Mail item. This is the default item for Outlook and the default type for all MAPIFolder objects that hold Mail type Items.
olNoteItem 5 A Note item
olPostItem 6 A Post item
olTaskItem 3 A Task Item

DefaultMessageClass Property

The DefaultMessageClass property returns, as a string, the Message Class, or type of message, for the MAPIFolder. This is the MessageClass property that, if not otherwise explicitly set, is assigned to an Outlook item by default when added to a folder. This value identifies the default Inspector object in which an item will be shown.

String = MAPIFolderObject.DefaultMessageClass

The possible values that will be returned are as follows:

IPM.Activity IPM.Appointment IPM.Contact
IPM.Note IPM.StickyNote IPM.Task

There is a one to one relationship between this property and the DefaultItemType property


Dim onMAPI As NameSpace
Dim ofcRoot As Folders
Dim ofPersonalFolder As MAPIFolder
Dim ofcPFolders As Folders
Dim ofFolder As MAPIFolder
Set onMAPI = Application.GetNamespace("MAPI")
Set ofcRoot = onMAPI.Folders
Set ofPersonalFolder = ofcRoot.Item("Mailbox – Dwayne Gifford")
Set ofcPFolders = ofPersonalFolder.Folders

For Each ofFolder In ofcPFolders
Debug.Print ofFolder.Name, ofFolder.DefaultMessageClass, ofFolder.DefaultItemType

This example walks through my Personal folders and displays both the DefaultMessageClass and DefaultItemType properties in the Immediate Window. The results are shown below.

Folder Name DefaultMessageClass DefaultItemType
Calendar IPM.Appointment


Contacts IPM.Contact


Deleted Items IPM.Note


Drafts IPM.Note


Inbox IPM.Note


Journal IPM.Activity


Notes IPM.StickyNote


Outbox IPM.Note


Sent Items IPM.Note


Tasks IPM.Task


Description Property

The Description property sets or returns a string value that provides information about the MAPIFolder. This property can be viewed in the Description box that you see in the Properties box for the MAPIFolder. For compatibility it corresponds to the PR_COMMENT property used in MAPI.

Blow Up!

String = MAPIFolderObject.Description

MAPIFolderObject.Description = String

I would suggest that if you are creating important MAPIFolders through code on a user’s machine then it is worth using this Description property to tell the user the purpose of the folder and that it should not be deleted.

EntryID Property

The EntryID property returns a unique ID for the MAPIFolder. It is created when the MAPIFolder is created or moved to a different folder. It may be used in conjunction with the GetFolderFromID method of the NameSpace object.

String = MAPIFolderObject.EntryID

This property is here for backwards compatibility with MAPI.

Folders Property

The Folders property returns the collection of folders that belong to the specified MAPIFolder, i.e. the sub-folders of the current object.

Set FoldersCollection = MAPIFolderObject.Folders

These Folders collections are recursive in nature, i.e. any one of the MAPIFolder objects in the Folders collection can contain its own Folders collection. The only way to ensure that you are at the bottom of a hierarchy of folders is to check that the Count property of the Folders collection equals 0.

Items Property

The Items property returns the collection of items within the specified MAPIFolder object.

Set ItemsCollection = MAPIFolderObject.Items

From this collection we have the ability to navigate around and work with the various Outlook Items. The Items collection and each of the Outlook items are covered fully in chapters 12 to 18.

Name Property

The Name property returns a string that represents the name of the MAPIFolder object. You can also set the name value using this property. The Name property of the folders is shown when you view the Outlook folders hierarchy.

String = MAPIFolderObject.Name

MAPIFolderObject.Name = String

If, within a particular Folders collection, you try to set the Name property of a MAPIFolder to the name of an already existing MAPIFolder an error will be raised.

Parent Property

The Parent property returns the parent object for the current object. In this case since we are looking at a MAPIFolder object the parent will the MAPIFolder object directly above it in the folders hierarchy.

Set MAPIFolderObject = MAPIFolderObject.Parent

UnReadItemCount Property

The UnReadItemCount property returns a long integer representing the number of messages within the current MAPIFolder that have not been read.

Long = MAPIFolderObject.UnReadItemCount

StoreID Property

The StoreID property returns a unique ID of the MAPIFolder object. This value is set when the object is created or moved to a new Folders collection. It is not clear why two unique ID’s, i.e. the EntryID and the StoreID are required.

String = MAPIFolderObject.StoreID

Session Property

The Session property returns the NameSpace object for the current session. This will be the MAPI.

Set NameSpaceObject = MAPIFolderObject.Session

WebViewAllowNavigation Property

The WebViewAllowNavigation property returns or sets a Boolean value indicating the "navigation mode" for the Web view.

Boolean = MAPIFolderObject.WebViewAllowNavigation

MAPIFolderObject.WebViewAllowNavigation = Boolean

By setting this to True the user has ability to use the Back and Forward buttons for Web navigation.

WebViewOn Property

The WebViewOn property returns or sets a Boolean value indicating the Web "view state" for the current MAPIFolder object. If set to True then Outlook is told to display the Web page specified in the WebViewURL property.

Boolean = MAPIFolderObject.WebViewOn

MAPIFolderObject.WebViewOn = Boolean

WebViewURL Property

The WebViewURL property returns or sets a string value indicating the URL of the web page assigned to this MAPIFolder object.

String = MAPIFolderObject.WebViewURL

MAPIFolderObject.WebViewURL = String

This information is based on Dwayne Gifford's book, Outlook 2000 VBA Programmers Reference

Page 6 of 6

Comment and Contribute


(Maximum characters: 1200). You have characters left.



Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Sitemap | Contact Us

Thanks for your registration, follow us on our social networks to keep up-to-date
Rocket Fuel