private void OnItemSavedOrDeleted(object item, ItemAction action) { IOutlookId entryId = null; bool wasDeleted = action == ItemAction.Delete; var appointment = item as AppointmentItem; if (appointment != null) { //Don't add appointment if it is a meeting invite, since this can cause doubled and/or cancelled meetings if (appointment.MeetingStatus != OlMeetingStatus.olMeetingReceived) { s_logger.Debug($"'{nameof (ItemAction)}.{action}': Appointment '{appointment.Subject}' '{appointment.EntryID}' "); entryId = new AppointmentId(new Implementation.Events.AppointmentId(appointment.EntryID, appointment.GlobalAppointmentID), appointment.LastModificationTime, wasDeleted); } } else { var task = item as TaskItem; if (task != null) { s_logger.Debug($"'{nameof (ItemAction)}.{action}': Task '{task.Subject}' '{task.EntryID}' "); entryId = new GenericId(task.EntryID, task.LastModificationTime, wasDeleted); } else { var contact = item as ContactItem; if (contact != null) { s_logger.Debug($"'{nameof (ItemAction)}.{action}': Contact '{contact.LastNameAndFirstName}' '{contact.EntryID}' "); entryId = new GenericId(contact.EntryID, contact.LastModificationTime, wasDeleted); } } } if (entryId != null) { OnItemSavedOrDeleted(entryId); } }
private void OnItemSavedOrDeleted (object item, ItemAction action) { IOutlookId entryId = null; bool wasDeleted = action == ItemAction.Delete; var appointment = item as AppointmentItem; if (appointment != null) { //Don't add appointment if it is a meeting invite, since this can cause doubled and/or cancelled meetings if (appointment.MeetingStatus != OlMeetingStatus.olMeetingReceived) { s_logger.Debug ($"'{nameof (ItemAction)}.{action}': Appointment '{appointment.Subject}' '{appointment.EntryID}' "); entryId = new AppointmentId(new Implementation.Events.AppointmentId(appointment.EntryID, appointment.GlobalAppointmentID), appointment.LastModificationTime, wasDeleted); } } else { var task = item as TaskItem; if (task != null) { s_logger.Debug ($"'{nameof (ItemAction)}.{action}': Task '{task.Subject}' '{task.EntryID}' "); entryId = new GenericId(task.EntryID, task.LastModificationTime, wasDeleted); } else { var contact = item as ContactItem; if (contact != null) { s_logger.Debug ($"'{nameof (ItemAction)}.{action}': Contact '{contact.LastNameAndFirstName}' '{contact.EntryID}' "); entryId = new GenericId (contact.EntryID, contact.LastModificationTime, wasDeleted); } } } if (entryId != null) OnItemSavedOrDeleted (entryId); }