Find Deleted Meeting in Outlook by Delphi

I am trying to integrate our program with Outlook and my test code below (sort of works) but has the following problems.

During testing, I was able to add an appointment. Then manually moved the appointment to a different date / time and restarted the test program and it came back (as expected). But...

when the item is removed, the code below can still find the item (somehow!). I even manually deleted the item from the Deleted Items folder in Outlook.

as a result, since it "found" the destination, it then tries to update it, resulting in an AV. I suspect there is something wrong with my use of the find function, but I am trying to use userProperties to add something from our system to add a destination item to Outlook and update if needed. But you also need to be able to handle the case where the user can manually remove an item from the calendar.

Any help would be greatly appreciated.

folder := ns.GetDefaultFolder(olFolderCalendar);

if not VarIsNull(folder) and not VarIsEmpty(folder) then
begin
try
  appointment := folder.Items.Find('[MyRecProperty2]=' + quotedStr(1001));
  entryFound := true;
except
end;

if (not entryFound) or
  (varType(Appointment)=varNull) or
  (varType(Appointment)=varEmpty) then
begin
  appointment := folder.Items.Add(olAppointmentItem);
  prop := appointment.UserProperties.Add('MyRecProperty2',olText,True);
  prop.Value := '1001';
  NewAppointment(appointment);
end
else
begin
  showmessage('updating appointment!');
  FillAppointment(appointment, false);
end;

showmessage('saving appointment!');
appointment.Save;

//showmessage('display appointment!');
//appointment.Display(true);

      

+3
outlook delphi


source to share


No one has answered this question yet

Check out similar questions:

79
Get calendar items (Outlook API, WebDAV) showing strange behavior
3
Create an extended property using EWS and access it from an Outlook add-in
3
Get the current Outlook meeting
1
VSTO Outlook Getting TimeZoneStruct From Destination
1
Excel VBA Outlook Non-default calendar assignment
0
Checking shared calendars - Outlook VBA
0
Outlook VBA AppointmentItem.Move creates a copy
0
How does the WebEx addin know that it is the WebEx application that it is updating in Outlook?
0
Runtime Error 438: Remove Outlook Outlook from Excel
-1
How do I develop an add-in add-in?



All Articles
Loading...
X
Show
Funny
Dev
Pics