Reference a folder

Microsoft Outlook

Reference a folder

To reference a folder by the name of the folder, use the following code.

Application.GetNameSpace("MAPI").Folders("Personal Folders").Folders("Product Ideas")

To reference a folder by a number, use the following code. In this example, the first folder in the folder collection Personal Folders is referenced.

Application.GetNameSpace("MAPI").Folders("Personal Folders").Folders(1)

To reference any of the default Outlook folders, use the GetDefaultFolder method. Use the value from the table below to specify the folder you want to create.

Application.GetNameSpace("MAPI").GetDefaultFolder(6)
Default folder Has the value
Deleted Items 3
Outbox 4
Sent Items 5
Inbox 6
Calendar 9
Contacts 10
Journal 11
Notes 12
Tasks 13