Testing for MAPI , again

  • Thread starter Thread starter Simon Woods
  • Start date Start date
S

Simon Woods

Hi

I previously posted asking about how to test, programmatically, to see
whether MAPI was supported on the machine my software was running on.

Zoury helpfully offered ...

Function SupportsMAPI() As Boolean
Dim o As Object
On Error Resume Next
Set o = CreateObject("MAPI.Session")
SupportsMAPI = Not o Is Nothing
End Function

However, although this test works fine on my own machine
(Win2K/Outlook2000), it fails (i.e. returns false) on other machines,
running various versions of Windows (XP/Win2K) and Outlook (2000/2002).

Can anyone offer why this may be so?

Thanks

Simon
 
CreateObject("MAPI.Session") does not test whether MAPI is supported. It tests whether the Collaboration Data Objects library is installed and available. Since CDO is an optional Outlook component and doesn't install on first use, that test will fail if CDO was not explicitly installed with Outlook/Office.

Are you trying to find out whether Simple MAPI is available (i.e. whether the user has a default mail client)? Or whether a client using Extended MAPI, in other words Outlook, is installed?
 
Thanks Sue

Simple MAPI



CreateObject("MAPI.Session") does not test whether MAPI is supported. It
tests whether the Collaboration Data Objects library is installed and
available. Since CDO is an optional Outlook component and doesn't install on
first use, that test will fail if CDO was not explicitly installed with
Outlook/Office.

Are you trying to find out whether Simple MAPI is available (i.e. whether
the user has a default mail client)? Or whether a client using Extended
MAPI, in other words Outlook, is installed?
 
Hi Sue !
Since CDO is an optional Outlook component and doesn't install on first
use, that test will fail if CDO was not explicitly installed with
Outlook/Office.

Good to know. Thanks for the correction.
 
Sue, perhaps I should elaborate a bit more

I'm looking to simply email a zip file. The app I'm using has references to
MSMAPI32.ocx and I'm using the controls to do the sending, i.e. just to
place a message with the attached zip file in the outbox of the default mail
client. I'm wanting to check that everything will be okay or else I'll
feedback to the user to send the file manually.

Thanks

Simon



CreateObject("MAPI.Session") does not test whether MAPI is supported. It
tests whether the Collaboration Data Objects library is installed and
available. Since CDO is an optional Outlook component and doesn't install on
first use, that test will fail if CDO was not explicitly installed with
Outlook/Office.

Are you trying to find out whether Simple MAPI is available (i.e. whether
the user has a default mail client)? Or whether a client using Extended
MAPI, in other words Outlook, is installed?
 
I've never gone looking for a simple test, so this may be a kludge: Examine Win.ini and look for the [Mail] section:

[Mail]
OLEMessaging=1
MAPIXVER=1.0.0.1
MAPIX=1
MAPI=1

If Simple MAPI is present and enabled, you'll have this value present:

MAPI=1

Of course, that won't tell you whether the user has actually set up any mail accounts for the Simple MAPI program.
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
So will

Set l_oMAPISession = CreateObject("MSMAPI.MAPISession")

tell you if Outlook or OutlookExpress or Thunderbird is available

Thanks

S



I've never gone looking for a simple test, so this may be a kludge: Examine
Win.ini and look for the [Mail] section:

[Mail]
OLEMessaging=1
MAPIXVER=1.0.0.1
MAPIX=1
MAPI=1

If Simple MAPI is present and enabled, you'll have this value present:

MAPI=1

Of course, that won't tell you whether the user has actually set up any mail
accounts for the Simple MAPI program.
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Check under HKLM\Software\Clients\Mail for the default value. Then check
under that subkey of HKLM\Software\Clients\Mail having as its name the value
you've just retrieved. The value of the DLLPath value is the simple MAPI
provider DLL. The value of the DLLPathEx is the extended MAPI provider DLL.

When you create a MAPI session, the stub DLL will load the appropriate DLL.
The "builtin" VB6 MAPI control requires the extended provider.

If the above doesn't yield a value, you don't have a suitable MAPI client
installed. In that case, the message in the PreFirstRun value under
HKLM\Software\Clients\Mail should be displayed.

So for example, Outlook Express only has a DLLPath, not a DLLPathEx. Thus OE
supports only SMAPI.

Since Outlook 2003 on XP does support full MAPI, Zoury's code will work when
Outlook 2003 is the default mail client, and will fail when Outlook Express
is the default mail client. Note that the MAPI API only supports ONE mail
provider, so that if the default mail client is not adequate, you are stuck.
The PreFirstRun message will give the user a hint.

Alternative: Use CDOSYS.
 
Back
Top