有什么方法可以知道Outlook.reminder是否为AppointmentItem所拥有?我有一个eventHandler,当一个提醒被触发时,它就会被触发。在这种情况下,我想知道哪一个Outlook项目拥有提醒,以及它是否是一个AppointmentItem (如果它适合其他规则来取消提醒)。
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);
}
}
}
}
}发布于 2015-06-19 16:52:35
使用Reminder.Item属性-它将返回相应的AppointmentItem、TaskItem、MailItem等。您将需要检查实际类型和/或将其转换为适当的对象。
https://stackoverflow.com/questions/30942888
复制相似问题