Difference in Outlook 2000 and 2003 get MAPI name space when running as a service.

  • Thread starter Thread starter Mike M.
  • Start date Start date
M

Mike M.

I have an app written in c++ that runs as a service on Windows 2000. It
uses the MAPI namespace to get the requested folder. For Outlook 2003 I was
just getting the namespace. For Outlook 2000 I also need to do a namespace
logon or I get an exception when I try to access any methods of namespace
interface. Anyone know why this might be?

TIA

Outlook::_ApplicationPtr application;
Outlook::_NameSpacePtr anamespace;

application.CreateInstance("Outlook.Application");

Outlook::MAPIFolderPtr aFolder;

anamespace = application->GetNamespace("MAPI");

#if 0
// Need to logon for Outlook 2000 to work.
anamespace->Logon("mydomain.net\\myname", "password");
#endif
 
Well, I need to get the body of calendar items and in Outlook 2003 it was
changed to a "secure" field. I need to use MAPI to get that field. But
that is something different. What I use the namespace for is to get the
specified (or default) folder (calendar) the customer is putting their
entries in. The service periodically instantiates Outlook, presuses the
calendar items and generates some files. It is (was) a pretty simple
program using the object model and then MAPI got involved. ;-)
 
Outlook is not suitable for use in an application running as a service. CDO
would be a better choice.
 
See Outlook Object Model unsuitable to run in a Windows service at
http://support.microsoft.com/default.aspx?scid=kb;en-us;237913. Again, CDO
might be more suitable. It certainly allows access to the folder hierarchy.

Also, "MAPI" could mean any of the following:

-- The MAPI namespace in the GetNamespace method of the Outlook object model
-- Simple MAPI
-- Extended MAPI

It pays to be specific about what you mean by "MAPI."

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
I'll read that article in-depth. Unfortunately I am working on an existing
app that runs as a service and uses the Outlook model. I added logic to use
Extended MAPI to get the body of the calendar item. I use the
GETMAPIOBJECT() method of the item. It works o.k. so far. I was just
curious about why I need to logon the namespace for Outlook 2000 and not
2003.

Thanks Sue.
 
That article has some information on how profiles work (or don't) when
Outlook is being used in a service.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Thanks Sue.

Sue Mosher said:
That article has some information on how profiles work (or don't) when
Outlook is being used in a service.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Back
Top