From 05c85daeee866e7f77c7fd67d25e45db00e68492 Mon Sep 17 00:00:00 2001 From: MATouin Date: Fri, 20 Nov 2020 20:31:10 +0100 Subject: [PATCH] Add calendar dates to the plugin --- JitsiMeetOutlook/NewJitsiAppointment.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/JitsiMeetOutlook/NewJitsiAppointment.cs b/JitsiMeetOutlook/NewJitsiAppointment.cs index 8072e26..94e0290 100644 --- a/JitsiMeetOutlook/NewJitsiAppointment.cs +++ b/JitsiMeetOutlook/NewJitsiAppointment.cs @@ -15,6 +15,10 @@ 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 @@ -28,6 +32,18 @@ public NewJitsiAppointment() newAppointment.Location = "Jitsi Meet"; newAppointment.Body = generateBody(jitsiRoomId); + 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);