GetDefaultFolder Method (Session Object)

The GetDefaultFolder method returns a Folder object from a message store.

Syntax

Set objFolder = objSession.GetDefaultFolder(ObjectType)

objFolder
On successful return, represents the default Folder object specified by ObjectType.
objSession
Required. The Session object.
ObjectType
Required. Long. Specifies the default folder to be retrieved.

Remarks

The GetDefaultFolder method returns the default folder of the specified type for the default message store of the current session.

The ObjectType parameter can have exactly one of the following values:

ObjectType setting Value Default folder retrieved
CdoDefaultFolderCalendar 0 Calendar
CdoDefaultFolderContacts 5 Contacts
CdoDefaultFolderDeletedItems 4 Deleted Items
CdoDefaultFolderInbox 1 Inbox
CdoDefaultFolderJournal 6 Journal
CdoDefaultFolderNotes 7 Notes
CdoDefaultFolderOutbox 2 Outbox
CdoDefaultFolderSentItems 3 Sent Items
CdoDefaultFolderTasks 8 Tasks

The Contacts, Journal, Notes, and Tasks folders are specific to Microsoft® Outlook™. If your application is running in a purely Microsoft® Schedule+ environment, an attempt to access any of these four folders returns CdoE_NOT_FOUND.

Not all message store providers support all folder types. A personal message store (PST), for example, typically does not support a calendar folder. If your profile specifies only a PST and you call GetDefaultFolder specifying CdoDefaultFolderCalendar, you may get a return of CdoE_NO_SUPPORT.