![]() |
Outlook Kalender Items finden und löschen
Hallo
ich möchte ein Programm für Outlook schreiben. Ich kann bereits Termine im Kalender anlegen:
Code:
Ich gebe also meinen neuen Termin eine individuelles Attribut GC-ID=1004.
var
outlook, ns, folder, appointment, prop: OLEVariant; const olFolderCalendar = $00000009; olText = 1; begin {initialize an Outlook} outlook := CreateOLEObject('Outlook.Application'); {get MAPI namespace} ns := outlook.GetNamespace('MAPI'); {get a default Contacts folder} folder := ns.GetDefaultFolder(olFolderCalendar); {if Contacts folder is found} if not VarIsNull(folder) then begin try appointment := folder.Items.Find('[GC-ID]=''1004'''); except end; if varType(Appointment)=varNull) or (varType(Appointment)=varEmpty) then begin showMessage('NEW'); {create a new item} appointment := folder.Items.Add(olAppointmentItem); prop := appointment.UserProperties.Add('GC-ID',olText,True); prop.Value := '''1004'''; {define a subject and body of appointment} appointment.Subject := 'new appointment'; appointment.Body := 'call me tomorrow'; {duration: 10 days starting from today} appointment.Start := Now(); appointment.End := Now()+10; {10 days for execution} appointment.AllDayEvent := 1; {all day event} {set reminder in 20 minutes} appointment.ReminderMinutesBeforeStart := 20; appointment.ReminderSet := 1; {set a high priority} appointment.Importance := olImportanceHigh; {to save an appointment} appointment.Save; Nun möchte ich genau diesen Termin später löschen. Hierfür verwende ich folgenden Code:
Code:
Das funktioniert auch. Allerdings findet mir die Find Methode - wenn ich nun wieder nach GC-ID=1004 suche - immer noch den Termin, obwohl ich ihn gelöscht habe.
var
outlook, ns, folder, appointment, prop: OLEVariant; const olFolderCalendar = $00000009; olText = 1; begin {initialize an Outlook} outlook := CreateOLEObject('Outlook.Application'); {get MAPI namespace} ns := outlook.GetNamespace('MAPI'); {get a default Contacts folder} folder := ns.GetDefaultFolder(olFolderCalendar); {if Contacts folder is found} if not VarIsNull(folder) then begin try appointment := folder.Items.Find('[GC-ID]=''1004'''); except end; if not (varType(Appointment)=varNull) or not (varType(Appointment)=varEmpty) then begin appointment.Delete; end; Hat jemand evtl. einen Tip für mich, wie ich einen Termin aus dem Kalender endgültig entfernen kann, damit er auch nicht mehr über Find gefunden wird? Vielen DAnk. Viele Grüße mc |
AW: Outlook Kalender Items finden und löschen
Hat noch nie jemand die Find-Methode bei der Outlook-Automatisierung verwendet und festgestellt, dass sie auch noch Termine findet, die eigentlich gelöscht wurden?
|
AW: Outlook Kalender Items finden und löschen
Bin zwar nicht der OL crack, jedoch sieht es so aus, als ob du den Eintrag im Papierkorb findest. Kannst du da nicht auf den Folder prüfen?
|
AW: Outlook Kalender Items finden und löschen
Vielen dank.
Das dachte ich auch zuerst.Allerdings findet Outlook immer noch etwas, auch wenn ich manuell die Email zuvor aus dem Papierkorb gelöscht habe... |
Alle Zeitangaben in WEZ +1. Es ist jetzt 02:29 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz