GetNamespace Method
The document is archived and information here might be outdated

Application.GetNamespace Method

Office 2007
Returns a NameSpace object of the specified type.

Syntax

expression.GetNamespace(Type)

expression   A variable that represents an Application object.

Parameters

NameRequired/OptionalData TypeDescription
TypeRequiredStringThe type of name space to return.

Return Value
A NameSpace object that represents the specified namespace.

Remarks

The only supported name space type is "MAPI". The GetNameSpace method is functionally equivalent to the Session property, which was introduced in Microsoft Outlook 98.

Example

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

Visual Basic for Applications
Sub ChangeCurrentFolder()
    Dim myNamespace As Outlook.NameSpace
	
    Set myNamespace = Application.GetNamespace("MAPI")
    Set Application.ActiveExplorer.CurrentFolder = _
    myNamespace.GetDefaultFolder(olFolderCalendar)
End Sub



Show:
© 2016 Microsoft