Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/delphi/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从Delphi中查找Outlook中已删除的约会_Delphi_Outlook_Appointment - Fatal编程技术网

从Delphi中查找Outlook中已删除的约会

从Delphi中查找Outlook中已删除的约会,delphi,outlook,appointment,Delphi,Outlook,Appointment,我正在尝试将我们的程序与outlook和下面的测试代码集成在一起(有点可行),但存在以下问题 在测试中,我可以添加约会。然后手动将约会移动到另一个日期/时间,并重新运行测试程序,然后它向后移动(如预期的那样)。但是 当一个项目被删除时,下面的代码仍然能够找到该项目(不知何故!)。我甚至从Outlook的“已删除邮件”文件夹中手动删除了该项目 因此,既然它“找到”了约会,它就会尝试更新它,结果也是AV。我怀疑我在使用find函数时出了问题,但我正在尝试使用userProperties从系统中添加一

我正在尝试将我们的程序与outlook和下面的测试代码集成在一起(有点可行),但存在以下问题

在测试中,我可以添加约会。然后手动将约会移动到另一个日期/时间,并重新运行测试程序,然后它向后移动(如预期的那样)。但是

当一个项目被删除时,下面的代码仍然能够找到该项目(不知何故!)。我甚至从Outlook的“已删除邮件”文件夹中手动删除了该项目

因此,既然它“找到”了约会,它就会尝试更新它,结果也是AV。我怀疑我在使用find函数时出了问题,但我正在尝试使用userProperties从系统中添加一些内容,以便添加到outlook中的约会项目中,并在需要时进行更新。但也需要能够处理用户可能从日历中手动删除项目的情况

如蒙协助,将不胜感激

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);

发现如果我循环查看日历中的所有约会,然后检查userProperties以查找我添加的“我的”属性,我可以到达我想要的约会,但是当我认为Find()应该可以工作时,这似乎是一种冗长的方法。哪一行提高了AV?父文件夹(parent.Name)的anem是什么约会应该在什么时候被删除?