CDO MAPI Session failing to retrieve user name but Getexchage user

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
 
S

Sue Mosher [MVP]

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
 
S

Sue Mosher [MVP]

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.
Thread starter Similar threads Forum Replies Date
B Exchange MAPI Client and CDO using RPC over HTTP / Outlook Anywhere Using Outlook 2
V Exchange MAPI/CDO Download? Exchange Server Administration 3
L Any Replacement for CDO and MAPI ? Outlook VBA and Custom Forms 6
T How can I send e-mail from an Access 2010 application using Outlook not CDO Using Outlook 1
C Variable Attachments in CDO/OL2K7? Outlook VBA and Custom Forms 4
M CDO hanging on Logoff Outlook VBA and Custom Forms 4
S MS Exchange 2010 and CDO Exchange Server Administration 2
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
V Add Additional MAPI address book GPO? Using Outlook 12
W Outlook 2010: Need to keep restarting outlook to download mail from a MAPI server Using Outlook 4
P “Word couldn’t send because of MAPI failure: “Operation not supported”. Using Outlook 2
F Install the Microsoft Exchange Server MAPI Client and Collaboration Data Objects 1.2.1 on Exchange 2 Exchange Server Administration 7
M Users exceeding the MAPI connection limit Using Outlook 5
D Can not find your mail folders by default. An unexpected error has occurred. MAPI was unable to load Using Outlook 2
E error code MAPI error 0x80040107. I'm trying to move email messages and email lists from my old MS Using Outlook 2
A Mapi session exceeded the maximum of 32 objects of type "session". Using Outlook 6
H Tracing MAPI Email Using Outlook 7
B just loaded outlook 2010 went to open it and just getting another box up saying Manged MAPI Service Catastrophic Failure. ( Eexption has beed thrown b Using Outlook 3
F Outlook 2007 appears broken after Office 2010 uninstall: problem with MAPI and mspst.dll Using Outlook 6
A MS Outlook 2010 Professional Plus - Word couldn't send mail because of a MAPI failure: "Operation no Using Outlook 4
M MAPI error 0X80040107 Using Outlook 5
S After installing 3rd party Certificate for IIS , prompt warning for mapi clients the name on security certificate is invalid , Exchange Server Administration 3
C Installing Mapi client on server 2008 r2 Using Outlook 2
D MAPI with POP3 ISP Using Outlook 1
C cas array and mapi Exchange Server Administration 1
B Where do MAPI clients connect when 2 CAS exist in a single AD site config? Exchange Server Administration 6
J Strange issue with distribution group names and MAPI Using Outlook 2
L MAPI setup and configuration Exchange Server Administration 16
N MAPI was unable to load the information service MSNCON.dll Using Outlook 5
E Redemption MAPI access(c#) Outlook VBA and Custom Forms 4
R Load Balancing MAPI ports Exchange Server Administration 18
E Google MAPI account Outlook VBA and Custom Forms 4
H Error code: Managed MAPI Service Catastrophic Failure Using Outlook 5
M Move Mailbox from Exchange 2010 to Exchange 2010 (no DAG) - Client Outlook MAPI Profile still lists Exchange Server Administration 9
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
Similar threads


















































Top