Reputation: 468
Is there a way to know if a Outlook.reminder is owned by a AppointmentItem ? I've got a eventHandler which is fired when a reminder is fired. In this case i would like to know which Outlook item owns the reminder and if it is an AppointmentItem if it fit other rules to dismiss the reminder.
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);
}
}
}
}
}
Upvotes: 1
Views: 894
Reputation: 66306
Use the Reminder.Item
property - it will return the corresponding AppointmentItem
, TaskItem
, MailItem
, etc. You will need to check the actual type and/or cast it to the appropriate object.
Upvotes: 1