private void permanentlyDeleteEmail( Microsoft.Office.Interop.Outlook.MailItem currMail) { Microsoft.Office.Interop.Outlook.Explorer currExplorer = Globals.ThisAddIn.Application.ActiveExplorer(); Microsoft.Office.Interop.Outlook.Store store = currExplorer.CurrentFolder.Store; Microsoft.Office.Interop.Outlook.MAPIFolder deletedItemsFolder = store.GetRootFolder().Folders[DELETED_ITEMS_FOLDER_NAME]; Microsoft.Office.Interop.Outlook.MailItem movedMail = currMail.Move(deletedItemsFolder); movedMail.Subject = movedMail.Subject + " "; movedMail.Save(); movedMail.Delete(); }
/// <summary> /// This method wraps an Outlook Explorer object and registers for the ExplorerClosed event. /// </summary> /// <param name="Explorer">The Outlook Explorer Object.</param> void WrapExplorer(Microsoft.Office.Interop.Outlook.Explorer Explorer) { // Wrap the Explorer and do some usefull with it ExplorerWrapper wrappedExplorer = new ExplorerWrapper(Explorer); Guid explorerId = wrappedExplorer.ID; if (_WrappedExplorers.ContainsKey(explorerId)) { return; } _WrappedExplorers.Add(explorerId, wrappedExplorer); // register for the closed event, so we can releas it from memory wrappedExplorer.ExplorerClosed += new ExplorerClosedDelegate(UnwrapExplorer); }
/** * * Moves a specified email to a specified destination folder by name. * */ private Microsoft.Office.Interop.Outlook.MailItem moveEmail( Microsoft.Office.Interop.Outlook.MailItem currMail, string destinationFolderName) { Microsoft.Office.Interop.Outlook.Explorer currExplorer = Globals.ThisAddIn.Application.ActiveExplorer(); Microsoft.Office.Interop.Outlook.Store store = currExplorer.CurrentFolder.Store; // Move the current email to User's selected Mail Box... Microsoft.Office.Interop.Outlook.MAPIFolder destFolder = store.GetRootFolder().Folders[destinationFolderName]; return(currMail.Move(destFolder)); }
/// <summary> /// This event occures en a new outlook explorer has been opened. /// </summary> /// <param name="Explorer">The opened Outlook Explorer object.</param> void Explorers_NewExplorer(Microsoft.Office.Interop.Outlook.Explorer Explorer) { // Wrap the Explorer and do some usefull with it Outlook.Explorer activeExplorer = Application.ActiveExplorer(); WrapExplorer(activeExplorer); }
void Explorers_NewExplorer(Microsoft.Office.Interop.Outlook.Explorer Explorer) { WriteToLog("Explorers_NewExplorer"); Explorer.SelectionChange += new Microsoft.Office.Interop.Outlook.ExplorerEvents_10_SelectionChangeEventHandler(explorer_SelectionChange); }
private void ThisAddIn_Startup(object sender, System.EventArgs e) { _explorer = this.Application.ActiveExplorer(); _explorer.SelectionChange += new ExplorerEvents_10_SelectionChangeEventHandler(_explorer_SelectionChange); }
void Explorers_NewExplorer(Microsoft.Office.Interop.Outlook.Explorer Explorer) { Explorer.SelectionChange += new Microsoft.Office.Interop.Outlook.ExplorerEvents_10_SelectionChangeEventHandler(Explorer_SelectionChange); listExplorers.Add(Explorer); }
void growl_NotificationCallback(Growl.Connector.Response response, Growl.Connector.CallbackData callbackData) { if (callbackData != null && callbackData.Result == Growl.CoreLibrary.CallbackResult.CLICK) { string type = callbackData.Type; if (type != null && type != String.Empty) { string id = callbackData.Data; object obj = this.Session.GetItemFromID(id, Type.Missing); switch (type) { case "mailmessage": if (obj != null && obj is Outlook.MailItem) { Outlook.MailItem message = (Outlook.MailItem)obj; EnableFullActivation(); message.Display(false); DisableFullActivation(); } obj = null; break; case "multimessage": object aw = this.ActiveWindow(); if (aw is Microsoft.Office.Interop.Outlook.Explorer) { Microsoft.Office.Interop.Outlook.Explorer explorer = (Microsoft.Office.Interop.Outlook.Explorer)aw; EnableFullActivation(); explorer.Activate(); DisableFullActivation(); } else if (aw is Microsoft.Office.Interop.Outlook.Inspector) { Microsoft.Office.Interop.Outlook.Inspector inspector = (Microsoft.Office.Interop.Outlook.Inspector)aw; EnableFullActivation(); inspector.Activate(); DisableFullActivation(); } break; case "remindermail": if (obj != null && obj is Outlook.MailItem) { Outlook.MailItem item = (Outlook.MailItem)obj; EnableFullActivation(); item.Display(false); DisableFullActivation(); } obj = null; break; case "reminderappointment": if (obj != null && obj is Outlook.AppointmentItem) { Outlook.AppointmentItem item = (Outlook.AppointmentItem)obj; EnableFullActivation(); item.Display(false); DisableFullActivation(); } obj = null; break; case "remindertask": if (obj != null && obj is Outlook.TaskItem) { Outlook.TaskItem item = (Outlook.TaskItem)obj; EnableFullActivation(); item.Display(false); DisableFullActivation(); } obj = null; break; } } } }