项目更改事件或先前项目状态之前的 VSTO Outlook

发布于 2024-12-06 12:16:10 字数 1311 浏览 0 评论 0原文

我正在开发一个视觉工作室 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文