public static bool SaveChangesToReservation(AppointmentItem appointment) { MeetingRequest request = null; string mrbs_uid = appointment.UserProperties["MJ-MRBS-ID"].Value.ToString(); int mrbs_id = -1; string ical_uid = ""; string[] splits = mrbs_uid.Split(';'); bool success = true; DisplayManager.ShowMessageWindow("Updating Reservation"); DisplayManager.UpdateMessageScreen("Checking for changes to entry..."); if (splits.Length > 0) { int.TryParse(splits[0], out mrbs_id); } if (splits.Length > 1) { ical_uid = splits[1]; } request = Database.GetRequestByEntry(mrbs_id, ical_uid, appointment.RecurrenceState == OlRecurrenceState.olApptMaster); if (request != null) { bool timeChanged = (request.Start != appointment.Start) || (request.End != appointment.End); //bool subjectChanged = request.Description != appointment.Subject; try { string mtg_id = ""; if (timeChanged) { request.Start = appointment.Start; request.End = appointment.End; } //if (subjectChanged) // request.Description = appointment.Subject; if (appointment.RecurrenceState == OlRecurrenceState.olApptMaster) { RecurrencePattern pattern = appointment.GetRecurrencePattern(); bool patternChanged = IsOutlookPatternDifferent(request, pattern); if (patternChanged) { request.LoadFromRecurrencePattern(pattern); } if (timeChanged || patternChanged /* || subjectChanged*/) { List <Entry> conflicts = Database.FindConflicts(request, mrbs_id); if (conflicts.Count > 0) { if (!DisplayManager.ShowConflictWindow(conflicts, true)) { request = Database.GetRequestByEntry(mrbs_id, ical_uid, true); UpdateOutlookAppointment(appointment, mrbs_uid, request, true); DisplayManager.HideMessageScreen(); return(false); } } DisplayManager.UpdateMessageScreen("Saving entry to MRBS..."); Database.RemoveRepeatingEntry(mrbs_id, ical_uid); mtg_id = Database.ReserveConferenceRoom(request); DisplayManager.UpdateMessageScreen("Reservation was successful!"); Thread.Sleep(1200); } else { DisplayManager.UpdateMessageScreen("No changes necessary"); Thread.Sleep(500); } } else if (timeChanged /* || subjectChanged*/) { List <Entry> conflicts = Database.FindConflicts(request, mrbs_id); if (conflicts.Count > 0) { DisplayManager.ShowConflictWindow(conflicts); request = Database.GetRequestByEntry(mrbs_id, ical_uid, false); UpdateOutlookAppointment(appointment, mrbs_uid, request); DisplayManager.HideMessageScreen(); return(false); } DisplayManager.UpdateMessageScreen("Saving entry to MRBS..."); mtg_id = Database.UpdateEntry(mrbs_id, ical_uid, request); DisplayManager.UpdateMessageScreen("Reservation was successful!"); Thread.Sleep(1200); } else { DisplayManager.UpdateMessageScreen("No changes necessary"); Thread.Sleep(500); } success = true; } catch (System.Exception ex) { string msg = ex.Message; while (ex.InnerException != null) { ex = ex.InnerException; msg += "\n" + ex.Message; } LogManager.LogException(ex); DisplayManager.ShowErrorWindow("Error reserving conference room", msg); success = false; } finally { DisplayManager.HideMessageScreen(); } } return(success); }