M
Microsoft
Hi Ken,
I tried to implement the following code in the ThisAddIn_Startup method on
application startup. The code seems to be working fine and no exception is
thrown on the run time. However, when I go back into the inbox and right
click on option, I couldn't find the 'x-testheader' in the header section. I
have tried out all the possible solutions that I can think of but still no
luck to make it work. Can you please give me some direction on what may went
wrong with the following code? thanks in advance.
foreach (Outlook.MAPIFolder folder in this.Application.Session.Folders)
{
Outlook.MAPIFolder inbox = folder.Folders["Inbox"];
foreach (object o in inbox.Items)
{
Outlook.MailItem mailItem = o as Outlook.MailItem;
if (mailItem != null)
{
// Adding x-header
string xHeaderTag =
"http://schemas.microsoft.com/mapi/string/{00020386-0000-0000-C000-000000000046}/x-testheader";
mailItem.PropertyAccessor.SetProperty(xHeaderTag,
mailItem.EntryID.ToString()); // set entry id value
mailItem.Save();
}
}
}
Cheers,
Kyle
I tried to implement the following code in the ThisAddIn_Startup method on
application startup. The code seems to be working fine and no exception is
thrown on the run time. However, when I go back into the inbox and right
click on option, I couldn't find the 'x-testheader' in the header section. I
have tried out all the possible solutions that I can think of but still no
luck to make it work. Can you please give me some direction on what may went
wrong with the following code? thanks in advance.
foreach (Outlook.MAPIFolder folder in this.Application.Session.Folders)
{
Outlook.MAPIFolder inbox = folder.Folders["Inbox"];
foreach (object o in inbox.Items)
{
Outlook.MailItem mailItem = o as Outlook.MailItem;
if (mailItem != null)
{
// Adding x-header
string xHeaderTag =
"http://schemas.microsoft.com/mapi/string/{00020386-0000-0000-C000-000000000046}/x-testheader";
mailItem.PropertyAccessor.SetProperty(xHeaderTag,
mailItem.EntryID.ToString()); // set entry id value
mailItem.Save();
}
}
}
Cheers,
Kyle