Partager via


_NameSpace.GetDefaultFolder Method

Returns a Folder object that represents the default folder of the requested type for the current profile; for example, obtains the default Calendar folder for the user who is currently logged on.

Namespace:  Microsoft.Office.Interop.Outlook
Assembly:  Microsoft.Office.Interop.Outlook (in Microsoft.Office.Interop.Outlook.dll)

Syntax

'Declaration
<DispIdAttribute()> _
Function GetDefaultFolder ( _
    FolderType As OlDefaultFolders _
) As MAPIFolder
'Usage
Dim instance As _NameSpace
Dim FolderType As OlDefaultFolders
Dim returnValue As MAPIFolder

returnValue = instance.GetDefaultFolder(FolderType)
[DispIdAttribute()]
MAPIFolder GetDefaultFolder(
    OlDefaultFolders FolderType
)

Parameters

Return Value

Type: Microsoft.Office.Interop.Outlook.MAPIFolder
A Folder object that represents the default folder of the requested type for the current profile.

Remarks

To return a specific non-default folder, use the Folders collection.

If the default folder of the requested type does not exist, depending on the type, Outlook may create and return the folder, or may raise an error. For example, if olFolderManagedEmail is specified as the FolderType but the Managed Folders group has not been deployed, Microsoft Outlook raises an error.

See Also

Reference

_NameSpace Interface

_NameSpace Members

Microsoft.Office.Interop.Outlook Namespace

Other Resources

How to: Add a Folder to the Folder List

How to: Get a Default Folder and Enumerate Its Subfolders

How to: Create a Mail Item by Using a Message Template