Basic MAPI

Alex Martelli aleaxit at yahoo.com
Thu Dec 28 18:08:30 CET 2000


<gbreed at cix.compulink.co.uk> wrote in message
news:92fonu$auu$1 at plutonium.compulink.co.uk...
    [snip]
> > > >>> s=Dispatch("Mapi.Session")
> >
> > There is no creatable coclass (that I ever heard of) with progId
> > 'Mapi.Session'.
>
> There most certainly is.  It comes with Outlook, among other things, and
> I think lives in cdo.dll ("MAPI" is an abbreviation for "CDO" or
> something).  That Dispatch works fine on my machine, so I don't know
> what's going wrong.  Check that Outlook's installed.

Aha -- maybe we have a clue here.  I do have Outlook installed, but,
it's Outlook 2000.  "Migrating Applications to Microsoft Outlook 2000"
by Jim Groves (found on MSDN) does list among the migration concerns:
"Collaboration Data Objects (CDO) [...] now optional".  And indeed,
I have no cdo.dll on my system, nor it it anywhere in my registry.

This is what Groves has to say about CDO versus MAPI:

"""
Support for Collaboration Data Objects
Formerly known as OLE Messaging and Active Messaging, CDO is an object model
that gives
applications more direct access to the Messaging Application Programming
Interface (MAPI) used by Outlook to structure its data storage than does the
Outlook object model.
Programming with CDO is more flexible than MAPI because, unlike MAPI, CDO
does not
require C or C++ as the programming language. Instead, CDO can be accessed
through
Visual Basic and Active Server Pages (ASP), as well as Visual C++® and any
other
development tool that creates Component Object Model (COM) objects.
"""

which I interpret as: CDO offers dual-interface COM access, so it can be
scripted from VB or anything else (Python included), while MAPI is a C/C++
only API (making it peculiar that a CDO object could possibly be named
'MAPI' something, but, whatever).

So, if Outlook 2000 is what you have, still quoting Groves:

"""
If users in your organization have already installed Outlook 2000, it is
easy for each
of them to install the CDO support.

To install CDO support
Click Start, point to Settings, and then click Control Panel.

Double-click the Add/Remove Programs icon.

In the list, click Microsoft Office 2000 or Microsoft Outlook 2000, and then
click Add/Remove.

Click Add or Remove Features.

Click the plus sign (+) next to Microsoft Outlook for Windows to open it.

Click Collaboration Data Objects, and then click Run from My Computer.
"""


Haven't tried this, so I don't know if this will indeed bring to life
a cdo.dll implementing a cocreatable "Mapi.Session" on your computer,
but, if Outlook2000 is what you're trying to work with, it sure seems
worth trying.  (There are other CDO implementations, "CDO for NTS" which
is said to use SMTP and run on NT Server only, and "CDO for Exchange
2000", but they apparently use different prog-id strings to let you
create their respective 'Session' objects).


Alex






More information about the Python-list mailing list