展望提醒获取约会项目

本文关键字:约会 项目 获取 | 更新日期: 2023-09-27 17:57:13

有没有办法知道Outlook.reminder是否由AppointmentProject拥有?我有一个事件处理程序,它在触发提醒时触发。在这种情况下,我想知道哪个Outlook项目拥有提醒,以及它是否是约会项目,如果它符合其他规则来关闭提醒。

 storage._Explorers = this.Application.Explorers;
 storage._Explorers.Application.Reminders.ReminderFire += new Outlook.ReminderCollectionEvents_ReminderFireEventHandler(Application_ReminderFire);

static void Application_ReminderFire(Outlook.Reminder reminder) {
        object item = reminder.Parent;
        if (item is Outlook.AppointmentItem) {
            AppointmentItem appointment = (item as AppointmentItem);
            MAPIFolder folder = appointment.Parent;
            StringCollection collection = Properties.Settings.Default.CALENDARS_SETTINGS;
            foreach (string chaine in collection) {
                string[] values = chaine.Split(new string[] { "," }, StringSplitOptions.None);
                if (folder.Name == values[0]) {
                    Boolean reminderChecked = Boolean.Parse(values[1]);
                    if (!reminderChecked) {
                        MessageBox.Show(reminder.Caption, "DISMISS", MessageBoxButtons.OK);
                    }
                }
            }
        }
    }

展望提醒获取约会项目

使用 Reminder.Item 属性 - 它将返回相应的AppointmentItemTaskItemMailItem等。您需要检查实际类型和/或将其强制转换为适当的对象。