Hallo #,
folgender Code klappt soweit ganz gut.
Leider bleibt aber die Outlook.Exe (Outlook 2007) offen.
Warum ?
Danke
Heiko
Delphi-Quellcode:
var
uses
OutlookXP;
var
Outlook: OutlookXP._Application;
// OutlookApplication; for D5 users
NmSpace: NameSpace;
Folder: MAPIFolder;
Inbox: MAPIFolder;
InboxSubFolder: MAPIFolder;
bFound: Boolean;
begin
Outlook := CoOutlookApplication.Create;
NmSpace := Outlook.GetNamespace('
MAPI');
NmSpace.Logon('
', '
', False, False);
Inbox:= NmSpace.GetDefaultFolder(olFolderInbox);
// MessageBox(0, PChar(IntToStr(Inbox.Items.Count)), 'Inbox', 0);
bFound:= False;
for i := 1
to Inbox.Folders.Count
do
begin
InboxSubFolder:= Inbox.Folders.Item(i);
sSubFolderName:= InboxSubFolder.
Name;
if sSubFolderName='
MySubFolder'
{heisst anders} then
begin
bFound:= True;
break;
end;
end;
Inbox:=
NIL;
InboxSubFolder:=
NIL;
NmSpace.Logoff;
Outlook.Quit;
Outlook :=
nil;
// Early binding with interfaces
end;