2017-10-11 78 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