|
-
Jul 27th, 2000, 04:43 AM
#1
Thread Starter
New Member
This is in VB6 with a reference to cdo.dll (Microsoft CDO 1.21 Library).
It is to read the details of the address book into the debug window (copied from MSDN) but I am having problems with CDO in particular the line :
Set objsession = CreateObject("MAPI.session") it gives a type mismatch error, does anyone have any ideas? The full procedure is included.
Help this is driving me mad!
Many Thanks
Rob
Procedure:
Dim objsession As MAPI.Session ' use early binding for efficiency
Dim collAddressLists As AddressLists
Dim objAddressList As AddressList
Dim collAddressEntries As AddressEntries
'On Error GoTo error_olemsg
' create a session and log on
Set objsession = CreateObject("MAPI.session")
' use a valid exchange profile name
objsession.Logon ("default exchange profile")
'Walk the available Address Books
Set collAddressLists = objsession.AddressBook
Set collAddressLists = objsession.AddressLists
Set collAddressLists = objsession
For Each objAddressList In collAddressLists
' Display collection selection indices
Debug.Print objAddressList.Name,
Debug.Print objAddressList.Index, ' Display readonly access flag
Debug.Print objAddressList.IsReadOnly, ' display count of recipients
Set collAddressEntries = objAddressList.AddressEntries
Debug.Print Str(collAddressEntries.Count) ' if any AddressEntries, display first recipient name
If Not objAddressList.AddressEntries(1) Is Nothing Then
Debug.Print objAddressList.AddressEntries(1).Name
End If
Next objAddressList ' Walk the Global Address List
Set collAddressEntries = objsession.AddressLists("Global Address List").AddressEntries
'WalkAddressList collAddressEntries
'close session and logoff
objsession.Logoff
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|