Application.GetNamespace Method (Outlook)

Office 2013 and later
GitHub-Mark-64px

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

Returns a NameSpace object of the specified type.

expression .GetNamespace(Type)

expression A variable that represents an Application object.

Parameters

Name

Required/Optional

Data Type

Description

Type

Required

String

The type of name space to return.

Return Value

A NameSpace object that represents the specified namespace.

The only supported name space type is "MAPI". The GetNameSpace method is functionally equivalent to the Session property.

This Visual Basic for Applications (VBA) example uses the CurrentFolder property to change the displayed folder to the user's Calendar folder.

Sub ChangeCurrentFolder() 
 
 Dim myNamespace As Outlook.NameSpace 
 
 
 
 Set myNamespace = Application.GetNamespace("MAPI") 
 
 Set Application.ActiveExplorer.CurrentFolder = _ 
 
 myNamespace.GetDefaultFolder(olFolderCalendar) 
 
End Sub
Show: