![]() |
| If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|||||||
| Tags: changes, mailitem, reflected, subject |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
I have added a group to an existing tab in the outlook 07 ribbon. One of the
controls in my group is a button that tries to read the subject from a mail item and then append some text. If it is a new mail item the subject always starts as null even if I have typed values in the email's subject. If it is a reply to an existing email the subject always comes in as the originals email's subject even if I changed it before clicking the button. I am somewhat new to this so it could be a simple problem. It almost seems like the subject is based on the first loading of the outlook email window and I need to refresh it somehow before I read the value of the subject. Here is my code. private void EncryptEmailButton_Click(object sender, RibbonControlEventArgs e) { try { Debug.WriteLine("EncryptEmailButton_Click"); this.BypassEncryptionEmail.Checked = false; Microsoft.Office.Interop.Outlook.Inspector window = Globals.ThisAddIn.Application.ActiveInspector(); if (window != null) { Microsoft.Office.Interop.Outlook.MailItem mail = (Microsoft.Office.Interop.Outlook.MailItem)window. CurrentItem; if (mail != null) { if (mail.Subject != null) mail.Subject = StripMessages(mail.Subject); mail.Subject = mail.Subject + " - Secured"; } } } catch (Exception ex) { Debug.WriteLine(ex.Message); } } Thanks for your help |
| Ads |
|
#2
|
|||
|
|||
|
Have you tried calling MailItem.Save to read the latest changes?
-- Eric Legault [MVP - Outlook] MCDBA, MCTS (Messaging & Collaboration, SharePoint Infrastructure, MOSS 2007 & WSS 3.0 Application Development) Collaborative Innovations NEW! - Try Picture Attachments Wizard 2.0 For Microsoft Outlook - Web: http://www.collaborativeinnovations.ca Blog: http://blogs.officezealot.com/legault "DavidReck" wrote in message ... I have added a group to an existing tab in the outlook 07 ribbon. One of the controls in my group is a button that tries to read the subject from a item and then append some text. If it is a new mail item the subject always starts as null even if I have typed values in the email's subject. If it is a reply to an existing email the subject always comes in as the originals email's subject even if I changed it before clicking the button. I am somewhat new to this so it could be a simple problem. It almost seems like the subject is based on the first loading of the outlook email window and I need to refresh it somehow before I read the value of the subject. Here is my code. private void EncryptEmailButton_Click(object sender, RibbonControlEventArgs e) { try { Debug.WriteLine("EncryptEmailButton_Click"); this.BypassEncryptionEmail.Checked = false; Microsoft.Office.Interop.Outlook.Inspector window = Globals.ThisAddIn.Application.ActiveInspector(); if (window != null) { Microsoft.Office.Interop.Outlook.MailItem mail = (Microsoft.Office.Interop.Outlook.MailItem)window. CurrentItem; if (mail != null) { if (mail.Subject != null) mail.Subject = StripMessages(mail.Subject); mail.Subject = mail.Subject + " - Secured"; } } } catch (Exception ex) { Debug.WriteLine(ex.Message); } } Thanks for your help |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Responses from meeting attendees are not reflected on Tracking tab | MW | Outlook - Calandaring | 3 | July 27th 07 07:02 PM |
| How to find a mailitem | bstrum | Add-ins for Outlook | 6 | June 21st 07 06:48 PM |
| Outlook 2003 - contacts only partially reflected in the addressboo | Ensy | Outlook - Using Contacts | 3 | May 26th 06 01:47 AM |
| Change of names/addresses should be reflected in adressbook-group | TheoG | Outlook - Using Contacts | 0 | May 24th 06 10:39 AM |
| How can I create a MailItem that displays like a received MailItem ? | Clive | Outlook - Using Forms | 0 | February 27th 06 05:14 PM |