private void ShowOutlookAppointmentsReminder()
        {
            try
            {
                var app = OutlookExtensions.GetRunningApplication();
                if (app == null)
                {
                    // Outlook is not running - do nothing
                    return;
                }

                var calendarFolder = app.GetCalendar();

                var upcoming = GetUpcomingAppointments(calendarFolder, lookahead, minStartTimeForReminders);

                if (upcoming.Any())
                {
                    var message = upcoming.Select(GetReminder).Join();
                    _context.Notify(message);
                }
            }
            catch (System.Exception ex)
            {
                log.Error(ex);
            }
        }
Exemple #2
0
        public void Delegate()
        {
            var app = OutlookExtensions.ProvideApplication();

            if (app.TryGetSelectedMail(out var mail))
            {
                app.Delegate(mail);
            }
        }
Exemple #3
0
        public void InviteEveryone()
        {
            var app = OutlookExtensions.ProvideApplication();

            if (app.TryGetSelectedMail(out var mail))
            {
                app.InviteEveryone(mail);
            }
        }
Exemple #4
0
        public void ReplyDu()
        {
            var app = OutlookExtensions.ProvideApplication();

            if (app.TryGetSelectedMail(out var mail))
            {
                app.ReplyDu(mail);
            }
        }
Exemple #5
0
        public void Todo(string subject)
        {
            var app  = OutlookExtensions.GetRunningApplication();
            var task = app.CreateTaskItem();

            task.Subject = subject;
            var s = new TimeParser().ParseSubject(subject);

            task.DueDate   = s.DueDate;
            task.StartDate = DateTime.Now;
            task.Subject   = s.Text;
            task.Save();
        }
Exemple #6
0
        public void Hello()
        {
            var app       = OutlookExtensions.ProvideApplication();
            var inspector = app.ActiveInspector();

            if (inspector == null)
            {
                return;
            }

            var item = inspector.CurrentItem as MailItem;

            if (item == null)
            {
                return;
            }

            inspector.Hello();
        }
Exemple #7
0
        public void Unsubscribe()
        {
            var app = OutlookExtensions.ProvideApplication();

            if (app.TryGetSelectedMail(out var mail))
            {
                var reply = app.OpenReply(mail);
                reply.Body = @"unsubscribe

To whom it may concern: 

I kindly ask you not not to send any further unsolicited mails to my email address.

Please unsubscribe my email address from your distribution list.

Best regards

" + reply.Body;
            }
        }
        public void CreateMeetingMinutes()
        {
            var outlook = OutlookExtensions.GetRunningApplication();

            if (outlook == null)
            {
                return;
            }

            var selectedAppointment = outlook.ActiveExplorer().Selection
                                      .OfType <AppointmentItem>().FirstOrDefault();

            if (selectedAppointment == null)
            {
                return;
            }

            var mdFile = CreateMeetingMinutesMarkdownFile(selectedAppointment);

            TextEditor.Open(mdFile);
        }