2017-10-11 117 views
1

我需要我的插件来检测何时删除定期会议。我的问题是BeforeDelete事件是以同样的方式触发的,如果我只删除集合中的一个事件或者我删除整个集合。我需要知道用户何时删除整个集合,而不仅仅是一个事件。项目中是否有一个变量提供了这个参考?C#Outlook插件 - 检测定期会议何时被删除

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

使用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

+0

完美。谢谢 – Troublesum