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

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
 
M

Mike M.

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. ;-)
 
S

Sue Mosher [MVP-Outlook]

Outlook is not suitable for use in an application running as a service. CDO
would be a better choice.
 
S

Sue Mosher [MVP-Outlook]

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
 
M

Mike M.

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.
 
S

Sue Mosher [MVP-Outlook]

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
 
M

Mike M.

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top