Ejemplo n.º 1
0
 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();
             }
         }
     }
 }
Ejemplo n.º 2
0
        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");
            }
        }