/// <summary> /// Switch to the calendar view when double-clicking a date /// </summary> /// <param name="sender">Sender</param> /// <param name="e">EventArgs</param> private void apptCalendar_CellDoubleClick(object sender, EventArgs e) { // Clicking in days outside of the current month will cause the calendar to refresh to that day // reposition all days and select the wrong one Outlook.Folder f = Globals.ThisAddIn.Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar) as Outlook.Folder; Globals.ThisAddIn.Application.ActiveExplorer().CurrentFolder = f; Outlook.CalendarView cv = (Outlook.CalendarView)(Globals.ThisAddIn.Application.ActiveExplorer().CurrentView); cv.CalendarViewMode = Outlook.OlCalendarViewMode.olCalendarViewDay; cv.GoToDate(this.apptCalendar.SelectedDate); }
private void UpdateSelectedAppointmentsOrCreateNew(string tag) { Outlook.View view = Globals.ThisAddIn._Explorer.CurrentView as Outlook.View; if (view.ViewType != Outlook.OlViewType.olCalendarView) { return; } Outlook.Folder folder = Globals.ThisAddIn._Explorer.CurrentFolder as Outlook.Folder; Outlook.CalendarView calView = view as Outlook.CalendarView; if (Globals.ThisAddIn._Explorer.Selection.Count != 0) { foreach (object obj in Globals.ThisAddIn._Explorer.Selection) { Outlook.AppointmentItem aitem = obj as Outlook.AppointmentItem; if (aitem == null) { continue; } if (aitem.IsRecurring || aitem.MeetingStatus != Outlook.OlMeetingStatus.olNonMeeting) { // clone this appointment DateTime dateStart = aitem.Start; DateTime dateEnd = aitem.End; aitem = folder.Items.Add("IPM.Appointment") as Outlook.AppointmentItem; aitem.ReminderSet = false; aitem.Start = dateStart; aitem.End = dateEnd; } if (aitem.Subject == null) { aitem.Subject = tag; } else { aitem.Subject = tag + " " + aitem.Subject.Trim(); } aitem.Save(); } } else { DateTime dateStart = calView.SelectedStartTime; DateTime dateEnd = calView.SelectedEndTime; Outlook.AppointmentItem aitem = folder.Items.Add("IPM.Appointment") as Outlook.AppointmentItem; aitem.ReminderSet = false; aitem.Start = dateStart; aitem.End = dateEnd; aitem.Subject = tag; aitem.Save(); } }
public NewJitsiAppointment() { // Get the Application object Outlook.Application application = Globals.ThisAddIn.Application; DateTime dateNull = new DateTime(4501, 1, 1, 0, 0, 0); Outlook.Explorer expl = application.ActiveExplorer(); Outlook.View view = expl.CurrentView as Outlook.View; try { // Generate meeting ID string jitsiRoomId = getRoomId(); // Create meeting object newAppointment = (Outlook.AppointmentItem)application.CreateItem(Outlook.OlItemType.olAppointmentItem); // Appointment details newAppointment.MeetingStatus = Outlook.OlMeetingStatus.olMeeting; newAppointment.Location = "Jitsi Meet"; newAppointment.Body = generateBody(jitsiRoomId); // Set appointment date if selected in calendar if (view.ViewType == Outlook.OlViewType.olCalendarView) { Outlook.CalendarView calView = view as Outlook.CalendarView; DateTime dateStart = calView.SelectedStartTime; DateTime dateEnd = calView.SelectedEndTime; if (dateStart != dateNull && dateEnd != dateNull) { newAppointment.Start = dateStart; newAppointment.End = dateEnd; } } // Display ribbon group, then the appointment window Globals.ThisAddIn.ShowRibbonAppointment = true; newAppointment.Display(false); Globals.ThisAddIn.ShowRibbonAppointment = false; // Set ribbon control defaults findThisRibbon(); // This only works after message is displayed to user setRequireDisplayName(); setStartWithAudioMuted(); setStartWithVideoMuted(); setRoomIdText(jitsiRoomId); } catch (Exception ex) { MessageBox.Show("The following error occurred: " + ex.Message); } }