项目更改事件或先前项目状态之前的 VSTO Outlook
我正在开发一个视觉工作室 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);
我需要能够保存更改的项目的先前状态,但在上面的事件处理程序中,我得到的只是已更改的项目。理想情况下,我需要的是“项目之前”更改事件,或者跟踪用户在 Outlook 中选择的项目,然后保存所需的属性状态(例如类别),然后我可以在更改的事件处理程序中访问它。
I am developing a visual studio VSTO add in and monitoring item changed events for mail, contacts, tasks and appointment items. This I have done using the following
//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);
I need to be able to save the previous state of the item changed, but in the above event handlers all I get is the item that has changed. Ideally what I require is a 'before item' changed event, or alternatively a way of keeping track of the item a user selects in outlook and then saving the required property state (e.g category), then I can access this in the changed event handler.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论