Delphi and MSG file
How do I display an Outlook message file using Delphi 2010? Is there a way to wra开发者_StackOverflow中文版p an Outlook app and open it within Delphi?
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.
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.
精彩评论