_Store.GetDefaultFolder Method

Returns a MAPIFolder object that represents the default folder in the store and that is of the type specified by the FolderType argument.

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 _Store
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
Returns a Folder object that represents the default folder of the requested type. If the default folder of the requested type does not exist, GetDefaultFolder returns Nothing (a null reference (Nothing in Visual Basic) in C#).

Remarks

This method is similar to the GetDefaultFolder(OlDefaultFolders) method of the NameSpace object. The difference is that this method gets the default folder on the delivery store that is associated with the account, whereas GetDefaultFolder of the NameSpace object returns the default folder on the default store for the current profile.

One example of when GetDefaultFolder returns Nothing (a null reference (Nothing in Visual Basic) in C#) is when olFolderManagedEmail is specified as the FolderType but the Managed Folders group has not been deployed.

See Also

Reference

_Store Interface

_Store Members

Microsoft.Office.Interop.Outlook Namespace