我正在开发一个视觉工作室VSTO添加并监视邮件,联系人,任务和约会项目的项目更改事件。我已经使用以下
完成了 //subsrribe to task events
taskItems = Globals.ThisAddIn.Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderTasks).Items;
taskItems.ItemChange += new Outlook.ItemsEvents_ItemChangeEventHandler(TaskItems_ItemChange);
taskItems.ItemAdd += new Outlook.ItemsEvents_ItemAddEventHandler(TaskItems_ItemAdd);
appointmentItems = Globals.ThisAddIn.Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar).Items;
appointmentItems.ItemAdd += new Outlook.ItemsEvents_ItemAddEventHandler(appointmentItems_ItemAdd);
//Added back as itemchanged requested
appointmentItems.ItemChange += new Outlook.ItemsEvents_ItemChangeEventHandler(appointmentItems_ItemChange);
contacts = Globals.ThisAddIn.Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts).Items;
contacts.ItemAdd += new Outlook.ItemsEvents_ItemAddEventHandler(contacts_ItemAdd);
contacts.ItemChange += new Outlook.ItemsEvents_ItemChangeEventHandler(contacts_ItemChange);
我需要能够保存更改的项的先前状态,但在上面的事件处理程序中,我得到的是已更改的项。理想情况下我需要的是一个'before item'更改事件,或者一种跟踪用户在outlook中选择的项目然后保存所需属性状态(例如category)的方法,然后我可以在更改的事件处理程序中访问它