function TfrmWiedervorlage.TerminAbfragen(datum:String):Boolean;
var
i : Integer;
Termine, Termin : OleVariant;
oItems, x : OleVariant;
GefilterteTermine : OleVariant;
sFilter, sFileName : String;
begin
try
Outlook:= CreateOleObject('Outlook.Application');
NmSpace:= Outlook.GetNamespace('
MAPI');
NmSpace.Logon(EmptyParam, EmptyParam, False, True);
Termine:= NmSpace.GetDefaultFolder(olFolderCalendar);
oItems := Termine.Items;
//Filter setzen: heutige Datum
GefilterteTermine := oItems.Restrict(sFilter);
i:= oItems.count //hier hat er die vier Termine drin
i:= GefilterteTermine.count; //hier sind es dann nur noch 0 ????
for i := 1 to gefilterteTermine.Count do
begin
Termin := GefilterteTermine.Item(i);
ShowMessage(Termin.Subject + ' '+ DateToStr(Termin.Start) );
x:= Termin.Attachments.Item(1);
sFileName:= x.FileName;
sFileName:= 'C:\'+sFileName;
x.SaveAsFile(sFileName);
DateiAuslesen(sFileName);
//Datei am Ende loeschen
DeleteFile(pChar(sFileName));
end;
Result:= True;
except
ShowMessage('Fehler in Funktion TerminAbfragen');
Result:= false;
end;
NmSpace.Logoff;
Termin:=Unassigned;
x:=Unassigned;
GefilterteTermine:= Unassigned;
Termine:= Unassigned;
Outlook:= Unassigned;
end;