MAPI fails on Outlook Express 6.0

M

msavoj

I have a windows forms application in C# that uses MAPI
and Outlook.application object for automatic send and it
works fine with Microsoft Outlook.


Outlook.Application oApp = new Outlook.Application();
Outlook.NameSpace oNS = oApp.GetNamespace("MAPI");
oNS.Logon("", null, null, null);
Outlook.MAPIFolder oMailFolder =
oNS.GetDefaultFolder
(Outlook.OlDefaultFolders.olFolderSentMail);
Outlook._MailItem oMailItem = (Outlook._MailItem)
oApp.CreateItem
(Outlook.OlItemType.olMailItem);
oMailItem.To = "";
oMailItem.Subject = "my subject";
oMailItem.Body = "content";


The app crashes when running outlook express 6.0 with the
message below:

COM Object with CLSID{HKEY_CLASSES_ROOT\CLSID\{0006F03A-
0000-0000-C000-000000000046} is either not valid or not
registered.


Is there a step that I am missing?
 
N

Norman Yuan

Of course, it must crash at the very first line of code: Outlook Express IS
NOT Outlook! They are different thng. Your code need Outlook installed.
Period.
 
N

Norman Yuan

Outlook Express does not support automation as Outlook (and other MS Office
apps). In VB6, you can use Shell and in .NET you use
System.Diagnotstics.Process to start OE (you have very little control on OE
other than start it). Maybe, if you dig into WIn API very deep, you may find
some that can help you do control OE to some extent.
 

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