public TestResult DoTest() { Outlook.Application application = null; DateTime startTime = DateTime.Now; try { // start outlook application = new Outlook.Application(); NetOffice.OutlookSecurity.Suppress.Enabled = true; Outlook.TaskItem newTask = application.CreateItem(OlItemType.olTaskItem) as Outlook.TaskItem; newTask.Subject = "Test item"; newTask.Body = "hello"; newTask.DueDate = DateTime.Now; newTask.Importance = OlImportance.olImportanceHigh; newTask.Close(OlInspectorClose.olDiscard); return(new TestResult(true, DateTime.Now.Subtract(startTime), "", null, "")); } catch (Exception exception) { return(new TestResult(false, DateTime.Now.Subtract(startTime), exception.Message, exception, "")); } finally { if (null != application) { application.Quit(); application.Dispose(); } } }
public void RunExample() { // start outlook by trying to access running application first // if its failed to resolve a running instance, we create a new one here Outlook.Application outlookApplication = COMObject.CreateByRunningInstance <Outlook.Application>(); // create a new TaskItem. Outlook.TaskItem newTask = outlookApplication.CreateItem(OlItemType.olTaskItem) as Outlook.TaskItem; // Configure the task at hand and save it. newTask.Subject = "Don't forget to check for NoScript updates"; newTask.Body = "check updates here: https://addons.mozilla.org/de/firefox/addon/noscript"; newTask.DueDate = DateTime.Now; newTask.Importance = OlImportance.olImportanceHigh; newTask.Save(); // close outlook and dispose if (!outlookApplication.FromProxyService) { outlookApplication.Quit(); } outlookApplication.Dispose(); HostApplication.ShowFinishDialog("Done!", null); }
public void RunExample() { // start outlook Outlook.Application outlookApplication = new Outlook.Application(); // create a new TaskItem. Outlook.TaskItem newTask = outlookApplication.CreateItem(OlItemType.olTaskItem) as Outlook.TaskItem; // Configure the task at hand and save it. newTask.Subject = "Don't forget to check for NetOffice.DeveloperToolbox updates"; newTask.Body = "check updates here: http://netoffice.codeplex.com/releases"; newTask.DueDate = DateTime.Now; newTask.Importance = OlImportance.olImportanceHigh; newTask.Save(); // close outlook and dispose outlookApplication.Quit(); outlookApplication.Dispose(); HostApplication.ShowFinishDialog("Done!", null); }