GetDefaultFolder Method (Session Object)

GetDefaultFolder Method (Session Object)

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

Syntax

Set objFolder = objSession.GetDefaultFolder(ObjectType [, mailbox] )

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.

mailbox

Optional. String. Specifies a delegate store in which to search for the folder.

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.

If CDO 1.2.1 and Microsoft® Outlook® 98 are sharing a stored profile, GetDefaultFolder returns CdoE_NO_SUPPORT if the ObjectType parameter specifies CdoDefaultFolderCalendar. To avoid this behavior, the recommended procedure is to use different profiles for CDO and Outlook 98. You can do this by specifying separate stored profiles for each, or by supplying the ProfileInfo parameter in the Session object's Logon method.

See Also

Concepts

Session Object