Properties added to MailItem in ItemSend event visible to recipien

  • Thread starter Eiríkur Fannar Torfason
  • Start date
E

Eiríkur Fannar Torfason

Hello everybody,

I have a shared add-in written in C# that will store certain custom
properties on a MailItem in the ItemSend event. I use the Redemption library
to add the custom properties.

My problem is that if the e-mail recipient is another user on the same
exchange server then these custom properties are present on the MailItem in
the recipients inbox. Is there anyway that this can be avoided while still
assigning the properties in the ItemSend event?

Here are the methods used to assign the custom properties to the MailItem.

private static void SetNamedMapiProperty(MailItem mailItem, string guid,
string propertyName, string propertyValue, bool unicode)
{
int tag = GetMapiTag(mailItem, guid, propertyName, unicode);
SafeMailItem safeMailItem = RedemptionUtils.CreateSafeMailItem(mailItem);
safeMailItem.set_Fields(tag, propertyValue);
Marshal.ReleaseComObject(safeMailItem);
}

private static int GetMapiTag(MailItem mailItem, string guid, string
propertyName, bool unicode)
{
MAPIUtils mapiUtils = RedemptionUtils.CreateMapiUtils();
int tag = mapiUtils.GetIDsFromNames(mailItem.MAPIOBJECT, guid,
propertyName, true);
if (unicode)
{
tag = tag | 0x1F;
}
else
{
tag = tag | 0x1E;
}
Marshal.ReleaseComObject(mapiUtils);
return tag;
}
 
S

Sue Mosher [MVP]

Use a different event -- wait until the item is added to the SentItems
folder.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top