D
DavidReck
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
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