CDO MAPI Session failing to retrieve user name but Getexchage user

  • Thread starter Thread starter paresh
  • Start date Start date
Status
Not open for further replies.
P

paresh

Hi, could anyone please tell me why attached CDO method is failing on some

computer to retrieve users list from my Outlook 2007 add-in? If gives it

says "Activax component cant create object".

The GetExchangeMethod always works but it is slower than CDO.

Any help would be really helpful.

Thanks.

Using CDO:

Dim cdoSession As Object

Dim cdoAddressList As Object

Dim cdoAddressEntries As Object

Dim cdoAddressEntry As Object

' ------------------------------' Create MAPI session and logged into it

' ------------------------------Set cdoSession = CreateObject("MAPI.Session")

cdoSession.Logon "", "", False, False, 0

' ------------------------------' Get all users address list

' ------------------------------Set cdoAddressList = cdoSession.AddressLists.Item("All Users")

' ------------------------------' Get address entries of the global address list

' ------------------------------Set cdoAddressEntries = cdoAddressList.AddressEntries

i = 1

' ------------------------------' Loop through the address entries collection and

' Add each address entry to the static array

' ------------------------------For Each cdoAddressEntry In cdoAddressEntries

ReDim Preserve allUsers(1 To i + 1) As String

allUsers(i) = cdoAddressEntry.Name

i = i + 1

Next

' ------------------------------' objects clean up

' ------------------------------Set cdoAddressList = Nothing

Set cdoAddressEntries = Nothing

Set cdoAddressEntry = Nothing

' ------------------------------' Logoff from MAPI Session

' ------------------------------cdoSession.Logoff

Set cdoSession = Nothing

Using GetExchangeUser method:

Dim i As Integer

i = 1

Dim oEntry As Outlook.AddressEntry

For i = 1 To usersList.Count

Set oEntry = usersList.Item(i)

ReDim Preserve allUsers(1 To i + 1) As String

allUsers(i) = oEntry.GetExchangeUser().Name

i = i + 1

Next
 
The most likely reason is that CDO is not installed on the machine. Outlook

2007 doesn't include CDO. You have to download and install it on each

machine that needs it.

Sue Mosher

"paresh" <paresh> wrote in message

news:C5BA0687-3483-47A8-9497-066326BF1A6E@microsoft.com...
> Hi, could anyone please tell me why attached CDO method is failing on some
> computer to retrieve users list from my Outlook 2007 add-in? If gives it
> says "Activax component cant create object".

> The GetExchangeMethod always works but it is slower than CDO.

> Any help would be really helpful.

> Thanks.

> Using CDO:

> Dim cdoSession As Object
> Dim cdoAddressList As Object
> Dim cdoAddressEntries As Object
> Dim cdoAddressEntry As Object
> ' ------------------------------------------------------------> ' Create MAPI session and logged into it
> ' ------------------------------------------------------------> Set cdoSession = CreateObject("MAPI.Session")
> cdoSession.Logon "", "", False, False, 0

> ' ------------------------------------------------------------> ' Get all users address list
> ' ------------------------------------------------------------> Set cdoAddressList = cdoSession.AddressLists.Item("All Users")

> ' ------------------------------------------------------------> ' Get address entries of the global address list
> ' ------------------------------------------------------------> Set cdoAddressEntries = cdoAddressList.AddressEntries
> i = 1

> ' ------------------------------------------------------------> ' Loop through the address entries collection and
> ' Add each address entry to the static array
> ' ------------------------------------------------------------> For Each cdoAddressEntry In cdoAddressEntries
> ReDim Preserve allUsers(1 To i + 1) As String
> allUsers(i) = cdoAddressEntry.Name
> i = i + 1
> Next

> ' ------------------------------------------------------------> ' objects clean up
> ' ------------------------------------------------------------> Set cdoAddressList = Nothing
> Set cdoAddressEntries = Nothing
> Set cdoAddressEntry = Nothing

> ' ------------------------------------------------------------> ' Logoff from MAPI Session
> ' ------------------------------------------------------------> cdoSession.Logoff
> Set cdoSession = Nothing

> Using GetExchangeUser method:

> Dim i As Integer

> i = 1

> Dim oEntry As Outlook.AddressEntry

> For i = 1 To usersList.Count
> Set oEntry = usersList.Item(i)
> ReDim Preserve allUsers(1 To i + 1) As String
> allUsers(i) = oEntry.GetExchangeUser().Name
> i = i + 1
> Next
 
The most likely explanation is that CDO is not present on the machine. It's

not part of Outlook and has to be downloaded and installed on every machine

where you want to use it.

Sue Mosher

"paresh" wrote:


> Hi, could anyone please tell me why attached CDO method is failing on some
> computer to retrieve users list from my Outlook 2007 add-in? If gives it
> says "Activax component cant create object".

> The GetExchangeMethod always works but it is slower than CDO.

> Any help would be really helpful.

> Thanks.

> Using CDO:

> Dim cdoSession As Object
> Dim cdoAddressList As Object
> Dim cdoAddressEntries As Object
> Dim cdoAddressEntry As Object
> ' ------------------------------------------------------------> ' Create MAPI session and logged into it
> ' ------------------------------------------------------------> Set cdoSession = CreateObject("MAPI.Session")
> cdoSession.Logon "", "", False, False, 0

> ' ------------------------------------------------------------> ' Get all users address list
> ' ------------------------------------------------------------> Set cdoAddressList = cdoSession.AddressLists.Item("All Users")

> ' ------------------------------------------------------------> ' Get address entries of the global address list
> ' ------------------------------------------------------------> Set cdoAddressEntries = cdoAddressList.AddressEntries
> i = 1

> ' ------------------------------------------------------------> ' Loop through the address entries collection and
> ' Add each address entry to the static array
> ' ------------------------------------------------------------> For Each cdoAddressEntry In cdoAddressEntries
> ReDim Preserve allUsers(1 To i + 1) As String
> allUsers(i) = cdoAddressEntry.Name
> i = i + 1
> Next

> ' ------------------------------------------------------------> ' objects clean up
> ' ------------------------------------------------------------> Set cdoAddressList = Nothing
> Set cdoAddressEntries = Nothing
> Set cdoAddressEntry = Nothing

> ' ------------------------------------------------------------> ' Logoff from MAPI Session
> ' ------------------------------------------------------------> cdoSession.Logoff
> Set cdoSession = Nothing

> Using GetExchangeUser method:

> Dim i As Integer

> i = 1

> Dim oEntry As Outlook.AddressEntry

> For i = 1 To usersList.Count
> Set oEntry = usersList.Item(i)
> ReDim Preserve allUsers(1 To i + 1) As String
> allUsers(i) = oEntry.GetExchangeUser().Name
> i = i + 1
> Next
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
L Any Replacement for CDO and MAPI ? Outlook VBA and Custom Forms 6
C Variable Attachments in CDO/OL2K7? Outlook VBA and Custom Forms 4
M CDO hanging on Logoff Outlook VBA and Custom Forms 4
B Strange MAPI/Exchange/IMAP behaviour in OL 2016 under10.0.19044.2006 Using Outlook 0
pcunite Outlook 2019/O365 Build 13127.20408 errors when using MAPI calls Using Outlook 1
F MAPI, User Defined Fields and perspective after 20 years Outlook VBA and Custom Forms 0
Dennis Gaudenzi Your setup couldn't be started because of an unexpected error (mapi 0x80040604) Using Outlook 14
A How to enable outlook room finder (outlook connector (mapi)) user ? Using Outlook 3
J Unwanted US Holiday Contact folder in Outlook.com syncs to MAPI/Phone Address book Using Outlook.com accounts in Outlook 9
P office 2013 communigate mapi Using Outlook 0
S Outlook 2013 MAPI 1.0 Error Using Outlook 2
L Mapi folder.FIND: error Using Outlook 0
J [outlook-users] Icloud + Mapi profile + Using Outlook 1
C MAPI to access a 64 bit Outlook from a 32 bit application; or access via ODBC Using Outlook 0
K Two MAPI Accounts One Contacts data set Using Outlook.com accounts in Outlook 2
E Redemption MAPI access(c#) Outlook VBA and Custom Forms 4
E Google MAPI account Outlook VBA and Custom Forms 4
R Create a new contact use MAPI? Outlook VBA and Custom Forms 2
A Generating valid MAPI URLs for Outlook 2003 Outlook VBA and Custom Forms 2
M Custom mapi is not displayed in the readingpane. Why? Outlook VBA and Custom Forms 1
M How to install custom mapi form programmatically? Outlook VBA and Custom Forms 1
M How to add a message to a mapi view folder Outlook VBA and Custom Forms 1
T Setting a MAPI property of type PT_SYSTIME Outlook VBA and Custom Forms 4
T Simple MAPI send and Outlook COM addin Outlook VBA and Custom Forms 3
D using extended MAPI Outlook VBA and Custom Forms 1
Q MAPI Read-only Folder Outlook VBA and Custom Forms 3
D MAPI programming issue - outbox doesn't exist? Outlook VBA and Custom Forms 2
L Cannot open PST file for first session each day Using Outlook 6
M McAllister Outlook stops Sending/Receiving/Synching after disconnecting remote desktop session Using Outlook 2
Jim H. Restricting session mail with ConversationID Using Outlook 6
D Creating an outlook session from Access vba but run silently. With A specific profile Outlook VBA and Custom Forms 1
M VBA Auto-Reply code for Two Mailboxes on one Outlook Session. Outlook VBA and Custom Forms 4
S Failed to create an RDO session instance: Class not registered Outlook VBA and Custom Forms 1

Similar threads

Back
Top