示例#1
0
        /**
         *
         * This method will permanently delete an email from Outlook, similar to
         * the use of the shift+delete manually on an email in Outlook.
         * Surprise, surprise...Microsoft does not have a method to easily
         * perform a PERMANENT DELETE of an email...you literally have to move
         * the phish eMail to the Deleted Items folder first, and then delete it
         * from there.  This is the only way, at least since the writing of this
         * comment, that we can permanently delete an email out of Outlook in
         * Visual C#
         *
         */
        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];

            // The move here will retain a reference to the MailItem entity that
            // is moved to the Deleted items folder...this is good because we
            // don't need to search for this email in Deleted Items...thank the
            // Maker!
            Microsoft.Office.Interop.Outlook.MailItem movedMail =
                currMail.Move(deletedItemsFolder);

            // Stupid Microsoft action here...need to change a value to trigger a
            // Save...otherwise, upcoming Delete will NOT OCCUR!!!!
            movedMail.Subject = movedMail.Subject + " ";

            // Need to save it...
            movedMail.Save();

            // Now, permanently delete it!
            movedMail.Delete();
        }
示例#2
0
        /**
         *
         * 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));
        }
示例#3
0
 void _OutlookApplication_StoreContextMenuDisplay(Microsoft.Office.Core.CommandBar CommandBar, Microsoft.Office.Interop.Outlook.Store Store)
 {
     DisplayInWatchWindow(StoreContextMenuDisplay++, System.Reflection.MethodInfo.GetCurrentMethod().Name);
 }