5

How do I display an Outlook message file using Delphi 2010? Is there a way to wrap an Outlook app and open it within Delphi?

CoffeeRain
  • 4,460
  • 4
  • 31
  • 50

2 Answers2

2

Use something like the following:

var App : OutlookApplication;
    NS : _Namespace;
    Msg : _MailItem;
begin
  App := CreateOleObject('Outlook.Application');
  NS := App.GetNamespace('MAPI');
  NS.Logon;
  Msg := NS.OpenSharedItem('c:\temp\test.msg');
  ShowMessage(Msg.Subject);

You can also use Redemption (I am its author) and its RDOSession.GetMessageFromMsgFile method.

Dmitry Streblechenko
  • 62,942
  • 4
  • 53
  • 78
0

TOutlookApplication ? It exists in D2007 and in Delphi XE. I assume it exists in D2010 too.

As an alternative you can import the Outlook Object Library through the Component->Import component... menu option.

Toto
  • 1,360
  • 1
  • 16
  • 18
  • I imported the Outlook Object Library. Can you please give me a short example on how to load a msg file and extract the html part of msg? Thanks –  May 11 '11 at 08:21
  • 3
    Here is a "similar" question and a good starting point: http://stackoverflow.com/questions/5022532/retrieving-outlook-inbox-and-sent-folders-in-delphi-using-ole/5022878#5022878 It is quite difficult, to "answer" the complete OLE-Interface to Outlook... – Andreas May 11 '11 at 08:33