Session Object (CDONTS Library)
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: |
|
Default property: |
Properties
Name |
Available since version |
Type |
Access |
1.2 |
String |
Read-only |
|
1.2 |
Long |
Read-only |
|
1.2 |
Folder object |
Read-only |
|
1.2 |
Long |
Read/write |
|
1.2 |
String |
Read-only |
|
1.2 |
Folder object |
Read-only |
|
1.2 |
Object; set to Nothing |
Read-only |
|
1.2 |
Session object (itself) |
Read-only |
|
1.2 |
String |
Read-only |
Methods
Name |
Available since version |
Parameters |
1.2 |
folderType as Long |
|
1.2 |
(none) |
|
1.2 |
DisplayName as String, Address as String |
|
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 "Display Name", "user@example.com"
This code fragment creates a Session object through late binding:
Dim objSession As Object
Set objSession = CreateObject ("CDONTS.Session")
objSession.LogonSMTP "Display Name", "user@example.com"
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.