コード例 #1
0
        public void ProvideFolderTest()
        {
            var app = OutlookExtensions.ProvideApplication();
            var f1  = app.ProvideFolder(OlDefaultFolders.olFolderCalendar, "test");

            log.Info(
                app.GetSession()
                .GetDefaultFolder(OlDefaultFolders.olFolderCalendar)
                .Folders.OfType <MAPIFolder>()
                .Select(_ => _.Name)
                .Join());

            var f2 = app.ProvideFolder(OlDefaultFolders.olFolderCalendar, "test");

            log.Info(
                app.GetSession()
                .GetDefaultFolder(OlDefaultFolders.olFolderCalendar)
                .Folders.OfType <MAPIFolder>()
                .Select(_ => _.Name)
                .Join());

            Assert.AreEqual(f1.Name, f2.Name);
            log.Info(
                app.GetSession()
                .GetDefaultFolder(OlDefaultFolders.olFolderCalendar)
                .Folders.OfType <MAPIFolder>()
                .Select(_ => _.Name)
                .Join());
        }
コード例 #2
0
        public void DelegateTest()
        {
            var app = OutlookExtensions.ProvideApplication();

            Assert.IsTrue(app.TryGetSelectedMail(out var mail));
            app.Delegate(mail);
        }
コード例 #3
0
        public void InviteEveryoneTest()
        {
            var app = OutlookExtensions.ProvideApplication();

            Assert.IsTrue(app.TryGetSelectedMail(out var mail));
            app.InviteEveryone(mail);
        }
コード例 #4
0
        public void TryGetSelectedMailTest()
        {
            var app = OutlookExtensions.ProvideApplication();

            Assert.IsTrue(app.TryGetSelectedMail(out var mail));
            log.Info(mail.Subject);
        }
コード例 #5
0
        public void ManipulateBody()
        {
            var     outlook   = OutlookExtensions.GetRunningApplication();
            var     inspector = outlook.ActiveInspector();
            dynamic editor    = inspector.WordEditor;
            dynamic selection = editor.Windows[1].Selection;

            selection.InsertBefore("Hello");
        }
コード例 #6
0
        public void GetOutlookAppointmentsActiveIn()
        {
            var app      = OutlookExtensions.GetRunningApplication();
            var calendar = app.GetCalendar();

            var time         = new TimeInterval(new DateTime(2019, 2, 20, 10, 0, 0), new DateTime(2019, 2, 20, 20, 15, 0));
            var appointments = calendar.GetOutlookAppointmentsActiveIn(time);

            foreach (var i in appointments)
            {
                Console.WriteLine($"{i.Start} {i.End} {i.RecurrenceState} {i.Subject}");
            }
            Assert.AreEqual(4, appointments.Count());
        }
コード例 #7
0
        public void AppointmentReminder()
        {
            var app            = OutlookExtensions.ProvideApplication();
            var ns             = app.GetNamespace("MAPI");
            var calendarFolder = ns.GetDefaultFolder(OlDefaultFolders.olFolderCalendar);
            var ti             = new TimeInterval(DateTime.Now, TimeSpan.FromMinutes(60));
            var upcoming       = app.GetOutlookAppointmentsStartingIn(calendarFolder, ti);

            log.Info(upcoming.ListFormat()
                     .Add(_ => _.Subject)
                     .Add(_ => _.Location)
                     .Add(_ => _.Start)
                     .Add(_ => _.End)
                     );
        }
コード例 #8
0
        public void BetterDecline()
        {
            var app      = OutlookExtensions.ProvideApplication();
            var explorer = app.ActiveExplorer();

            log.Info(explorer.Caption);

            var declinedFolder = app.ProvideFolder(OlDefaultFolders.olFolderCalendar, "declined");

            foreach (var i in explorer.Selection.OfType <AppointmentItem>())
            {
                log.Info(i.Subject);
                i.Respond(OlMeetingResponse.olMeetingDeclined);
                i.Move(declinedFolder);
            }
        }