它只工作一次,而不是事件处理程序不起作用。我不明白为什么?
private void ThisAddIn_Startup(object sender, System.EventArgs e) {
var folder = Globals.ThisAddIn.Application.Session.DefaultStore.
GetDefaultFolder(Outlook.OlDefaultFolders.olFolderTasks);
foreach(Outlook.TaskItem item in folder.Items) {
item.BeforeDelete += BeforeDelete;
item.Save();
}
}
private void BeforeDelete(object item, ref bool cancel) {
MessageBox.Show("Удалено");
// Marshal.ReleaseComObject(item); must I do It?
}