C#Outlook插件 - 检测何时删除定期会议

时间:2017-10-11 17:29:32

标签: c# plugins outlook

我需要我的插件来检测何时删除定期会议。我的问题是如果我只删除集合中的一个出现或者我删除整个集合,则以相同的方式触发BeforeDelete事件。我需要知道用户何时删除整个集合而不仅仅是单个事件。 Item中是否有一个变量可以引用它?

public void MailItem_BeforeDelete(object Item, ref bool Cancel) {

     Outlook.AppointmentItem MailItem = Item as Outlook.AppointmentItem;

     //Somewhere in this little guy [MailItem] should be something telling me if the 
     //item that is being deleted is a single occurance or is the entire set that is being deleted?
     //MailItem.IsRecurring is true in both instances so thats doesnt work. 
}

1 个答案:

答案 0 :(得分:1)

使用RecurrenceState属性。

从文档中,此属性设置为OlRecurrenceState枚举:

  • olApptMaster:1 - 约会是主要约会。
  • olApptOccurrence:2 - 约会是由主要约会定义的定期约会。

以下是文档的几个链接:

https://msdn.microsoft.com/VBA/Outlook-VBA/articles/appointmentitem-recurrencestate-property-outlook

https://msdn.microsoft.com/VBA/Outlook-VBA/articles/olrecurrencestate-enumeration-outlook