unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Buttons,ComObj,
ActiveX, OleServer, OutlookXP, StdCtrls, ComCtrls ;
type
TForm1 =
class(TForm)
SpeedButton2: TSpeedButton;
Label1: TLabel;
procedure SpeedButton2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.SpeedButton2Click(Sender: TObject);
var
i : Integer;
NewMail : boolean;
Outlook, NmSpace, currentFolder : OleVariant;
Begin
Outlook := CreateOleObject('
Outlook.Application');
//OK
NmSpace := Outlook.GetNamespace('
MAPI');
//OK
NmSpace.Logon(EmptyParam, EmptyParam, False, True);
//OK
currentFolder := NmSpace.GetDefaultFolder(olFolderInbox);
// ?warum gibts nicht: currentFolder := NmSpace.GetDefaultFolder(olCurrentFolder); -> MSDN-Doku hilft mir nicht weiter: Application.ActiveExplorer.CurrentFolder
NewMail := (currentFolder.UnreadItemCount > 0);
//OK
if NewMail
then
ShowMessage('
Ungelesene Nachrichten im Posteingangsordner: '+ inttostr(currentFolder.UnreadItemCount));
for i:=1
to currentFolder.items.Count
do
begin
if currentFolder.items[i].selected
then // Ist reine Phantasie !!!!!!!!! WIE KANN ICH SOWAS REALISIEREN
begin
ShowMessage('
Subjekt : '+currentFolder.items[i].Subject+#13+
'
Sendername : '+currentFolder.items[i].SenderName+#13+
'
von : '+currentFolder.items[i].SenderEmailAddress+#13+
'
an : '+currentFolder.items[i].
To);
end;
end;
end;
end.