private Appointment CreateAppointment(Appointment appointment) { try { Outlook.Application outlookApp = new Outlook.Application(); // creates new outlook app Outlook.AppointmentItem newAppo = (Outlook.AppointmentItem)outlookApp.CreateItem(Outlook.OlItemType.olAppointmentItem); // creates a new appointment newAppo.AllDayEvent = false; newAppo.ReminderSet = false; newAppo.Location = appointment.Location; newAppo.Start = appointment.Start; newAppo.Duration = appointment.Duration; newAppo.Subject = appointment.Subject; newAppo.Body = appointment.Body; newAppo.Save(); Appointment returnAppo = new Appointment(newAppo.GlobalAppointmentID, newAppo.Start, newAppo.Duration, newAppo.Subject, newAppo.Location, newAppo.Body, t.Bool(sqlController.SettingRead(Settings.colorsRule)), true, sqlController.Lookup); Outlook.MAPIFolder calendarFolderDestination = GetCalendarFolder(); Outlook.NameSpace mapiNamespace = outlookApp.GetNamespace("MAPI"); Outlook.MAPIFolder oDefault = mapiNamespace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar); if (calendarFolderDestination.Name != oDefault.Name) { newAppo.Move(calendarFolderDestination); } return(returnAppo); } catch (Exception ex) { throw new Exception("The following error occurred: " + ex.Message); } }