Scope of CDO:AddressBook method (C++/ATL)

  • Thread starter Thread starter Paul Keogh
  • Start date Start date
P

Paul Keogh

Hi,

I'm writing an add-in in ATL/C++. I've successfully created a CDO:Session
CoClass instance in the OnConnection method and successfully invoked the
GetVersion () method.

However, when I invoke the AddressBook () with no arguments it does'nt
display and the method returns immediately.

Whats the scope of the AddressBook () method ?

Do I need to logon to the CDO session first ?

Hanx!,
Paul.
 
Dmitry Streblechenko said:
How do you call the method and what does it return?

I was calling it as m_spSession -> AddressBook ().

Seems I need to call m_spSession -> Logon () first.
I added this and it works fine now.

Any suggestions on how to access the recipients collection object returned
from ATL ?
I've looked at the MFC CDO sample that wraps COleDispatchDisp but I want to
work
in ATL.

Would implementing the interface from olemsg32.dll work ?
 
Session.AddressBook returns Recipients object. Since you already have the
wrapper classes for the CDO objects, shouldn't be a problem to use this one
as well, even though I have no idea how (AttachDispatch()?), I don't use
C++.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
Dmitry Streblechenko said:
Session.AddressBook returns Recipients object. Since you already have the
wrapper classes for the CDO objects, shouldn't be a problem to use this one
as well, even though I have no idea how (AttachDispatch()?), I don't use
C++.

I have wrapper classes in MFC, not ATL which is what I have to use.

The whole purpose of using CDO is to get at the AddressBook GUI from within
my add-in. Its not available from the Outlook Object Model as far as I can
tell,
so its either CDO or extended MAPI that I have to use. BTW, the CDO
session Logon() method now throws an exception !.

<rant>
C++ is hardest way to do this stuff for sure. I find the docs and samples
from Microsoft
to be poor to the point of unusable. If I was'nt being paid for this,
there's no way I'd
touch these technologies.
</rant>
 
Back
Top