Session Property

Microsoft Outlook Visual Basic

Returns the NameSpace object for the current session.

Note  The Session property and the GetNamespace method can be used interchangeably to obtain the Namespace object for the current session. Both members serve the same purpose. For example, the following statements do the same function:
Set objNamespace = Application.GetNamespace("MAPI")
Set objSession = Application.Session

expression.Session

expression    Required. An expression that returns one of the objects in the Applies To list to which the Session property is being applied.

Example

The following Visual Basic for Applications (VBA) example shows how to use the Session property.

Sub GetSession()
    Dim outApp As Outlook.Application
    Dim nsp As Outlook.NameSpace
    
    Set outApp = CreateObject("Outlook.Application")
    Set nsp = outApp.Session
    
End Sub