Session Object (CDONTS Library)

The Session object contains session-wide settings and options.

At a Glance

Specified in type library: CDONTS.DLL
First available in: CDO for NTS Library version 1.2
Parent objects: (none)
Child objects: Folder
Default property: Name

Properties


Name
Available since version
Type

Access
Application 1.2 String Read-only
Class 1.2 Long Read-only
Inbox 1.2 Folder object Read-only
MessageFormat 1.2 Long Read/write
Name 1.2 String Read-only
Outbox 1.2 Folder object Read-only
Parent 1.2 Object; set to Nothing Read-only
Session 1.2 Session object (itself) Read-only
Version 1.2 String Read-only

Methods


Name
Available since version
Parameters
GetDefaultFolder 1.2 folderType as Long
Logoff 1.2 (none)
LogonSMTP 1.2 DisplayName as String,
Address as String
SetLocaleIDs 1.2 CodePageID as Long

Remarks

A Session object is considered a top-level object, meaning it can be created directly from a Microsoft® Visual Basic® program. In the CDO for NTS Library it has a ProgID of CDONTS.Session. This code fragment creates a Session object through early binding:

Dim objSession As CDONTS.Session 
Set objSession = CreateObject ("CDONTS.Session") 
objSession.LogonSMTP 
 

This code fragment creates a Session object through late binding:

Dim objSession As Object 
Set objSession = CreateObject ("CDONTS.Session") 
objSession.LogonSMTP 
 

Generally, early binding is preferable, because it enforces type checking and generates more efficient code. Note that you specify the full ProgID "CDONTS.Session" instead of just "Session" in order to distinguish a CDO application from other types of applications available to a Visual Basic program through other object libraries.

In both cases, after you create a new Session object, you call its LogonSMTP method to initialize it. No other activities with the CDO for NTS Library are permitted prior to a successful LogonSMTP call. The only exception to this rule is the Session object's SetLocaleIDs method.