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()); }
public void DelegateTest() { var app = OutlookExtensions.ProvideApplication(); Assert.IsTrue(app.TryGetSelectedMail(out var mail)); app.Delegate(mail); }
public void InviteEveryoneTest() { var app = OutlookExtensions.ProvideApplication(); Assert.IsTrue(app.TryGetSelectedMail(out var mail)); app.InviteEveryone(mail); }
public void TryGetSelectedMailTest() { var app = OutlookExtensions.ProvideApplication(); Assert.IsTrue(app.TryGetSelectedMail(out var mail)); log.Info(mail.Subject); }
public void ManipulateBody() { var outlook = OutlookExtensions.GetRunningApplication(); var inspector = outlook.ActiveInspector(); dynamic editor = inspector.WordEditor; dynamic selection = editor.Windows[1].Selection; selection.InsertBefore("Hello"); }
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()); }
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) ); }
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); } }