static void Main(string[] args) { using (var suppress = new Automation()) { Console.WriteLine("Concept Test - SuppressOutlookSecurity"); suppress.Enabled = true; suppress.OnAction += Suppress_OnAction; suppress.OnError += Suppress_OnError; Outlook.Application application = null; try { application = new Outlook.ApplicationClass(new NetOffice.Core(), true); SendMail(application); Console.WriteLine("Press any key..."); Console.ReadKey(); } catch (Exception exception) { Console.WriteLine(exception.ToString()); } finally { if (null != application) { if (application.FromProxyService) { application.Quit(); } application.Dispose(); } } } }
static void Main(string[] args) { Console.WriteLine("Create 3x Outlook Application"); Outlook.Application application1 = new Outlook.ApplicationClass(); Outlook.Application application2 = new Outlook.ApplicationClass(); Outlook.Application application3 = new Outlook.ApplicationClass(); Console.WriteLine("Done! Press any key"); Console.ReadKey(); application1.Dispose(); application2.Dispose(); application3.Dispose(); Console.WriteLine("Finish! Press any key.."); Console.ReadKey(); }
private static void TestOutlook() { Console.WriteLine("Test Outlook Application Utils"); Outlook.Application application = new Outlook.ApplicationClass(); Outlook.Tools.Contribution.CommonUtils utils = new Outlook.Tools.Contribution.CommonUtils(application); bool visible1 = utils.Application.Visible; application.Session.GetDefaultFolder(Outlook.Enums.OlDefaultFolders.olFolderInbox).Display(); System.Threading.Thread.Sleep(3000); bool visible2 = utils.Application.Visible; application.Quit(); application.Dispose(); if (!(false == visible1 && true == visible2)) { throw new Exception("Unexpected outlook visibility"); } }