Sdílet prostřednictvím


Session Property

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

Applies to | Action Object | Actions Object | AddressEntries Object | AddressEntry Object | AddressList Object | AddressLists Object | Application Object | AppointmentItem Object | Attachment Object | Attachments Object | Conflict Object | Conflicts Object | ContactItem Object | DistListItem Object | DocumentItem Object | Exception Object | Exceptions Object | Explorer Object | Explorers Object | Folders Object | FormDescription Object | Inspector Object | Inspectors Object | ItemProperties Collection | ItemProperty Object | Items Object | JournalItem Object | Link Object | Links Object | MailItem Object | MAPIFolder Object | MeetingItem Object | NameSpace Object | NoteItem Object | OutlookBarGroup Object | OutlookBarGroups Object | OutlookBarPane Object | OutlookBarShortcut Object | OutlookBarShortcuts Object | OutlookBarStorage Object | Pages Object | Panes Object | PostItem Object | PropertyPages Object | PropertyPageSite Object | Recipient Object | Recipients Object | RecurrencePattern Object | Reminder Object | Reminders Collection | RemoteItem Object | ReportItem Object | Results Collection | Search Object | Selection Object | SyncObject Object | SyncObjects Object | TaskItem Object | TaskRequestAcceptItem Object | TaskRequestDeclineItem Object | TaskRequestItem Object | TaskRequestUpdateItem Object | UserProperties Object | UserProperty Object | View Object | Views Collection