Session Object
Session Object
The Session object contains session-wide settings and options. It also contains properties that return top-level objects, such as CurrentUser.
At a Glance
Specified in type library: |
CDO.DLL |
First available in: |
CDO Library version 1.0.a |
Parent objects: |
(none) |
Child objects: |
AddressLists collection Folder (Inbox or Outbox) InfoStores collection |
Default property: |
Properties
Name |
Available since version |
Type |
Access |
1.1 |
AddressList object or AddressLists collection object |
Read-only |
|
1.0.a |
String |
Read-only |
|
1.0.a |
Long |
Read-only |
|
1.0.a |
AddressEntry object |
Read-only |
|
1.0.a |
Folder object |
Read-only |
|
1.0.a |
InfoStore object or InfoStores collection object |
Read-only |
|
1.0.a |
IUnknown object |
Read/write (Note: Not available to Visual Basic applications) |
|
1.0.a |
String |
Read-only |
|
1.0.a |
String |
Read-only |
|
1.0.a |
Folder object |
Read-only |
|
1.1 |
Boolean |
Read/write |
|
1.1 |
String |
Read/write |
|
1.0.a |
Object; set to Nothing |
Read-only |
|
1.0.a |
Session object (itself) |
Read-only |
|
1.0.a |
String |
Read-only |
Methods
Name |
Available since version |
Parameters |
1.0.a |
(optional) recipients as Object, (optional) title as String, (optional) oneAddress as Boolean, (optional) forceResolution as Boolean, (optional) recipLists as Long, (optional) toLabel as String, (optional) ccLabel as String, (optional) bccLabel as String, (optional) parentWindow as Long |
|
1.1 |
ID1 as String, ID2 as String |
|
1.1 |
(optional) ParentIndex as String |
|
1.1 |
(none) |
|
1.0.a |
entryID as String |
|
1.2 |
ObjectType as Long |
|
1.2 |
ArticleID as Long, FolderID as String, (optional) StoreID as String |
|
1.2 |
ObjectType as Long, (optional) mailbox as String |
|
1.0.a |
folderID as String, (optional) storeID as String |
|
1.0.a |
(optional) storeID as String |
|
1.0.a |
messageID as String, (optional) storeID as String |
|
1.2 |
OptType as String |
|
1.0.a |
(none) |
|
1.0.a |
(optional) profileName as String, (optional) profilePassword as String, (optional) showDialog as Boolean, (optional) newSession as Boolean, (optional) parentWindow as Long, (optional) NoMail as Boolean, (optional) ProfileInfo as String |
|
1.1 |
LocaleID as Long, CodePageID as Long |
|
1.2 |
OptType as String, OptValue as Variant |
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 Exchange Library it has a ProgID of MAPI.Session. This code fragment creates a Session object through early binding:
Dim objSession As MAPI.Session
Set objSession = CreateObject ("MAPI.Session")
objSession.Logon
This code fragment creates a Session object through late binding:
Dim objSession As Object
Set objSession = CreateObject ("MAPI.Session")
objSession.Logon
Generally, early binding is preferable, because it enforces type checking and generates more efficient code. Note that you specify the full ProgID “MAPI.Session” instead of just “Session” in order to distinguish a MAPI session from other types of sessions available to a Visual Basic program through other object libraries.
In both cases, after you create a new Session object, you use the Logon method to initiate a session with MAPI. No other activities with CDO are permitted prior to a successful logon. The only exception to this rule is the Session object’s SetLocaleIDs method.