c# - 共享 Outlook MailItem UserProperties

标签 c# outlook vsto outlook-addin

如何在 Outlook.MailItem 上设置随后不与收件人共享的属性?

示例代码:

Outlook.UserProperties mailUserProperties = null;
Outlook.UserProperty mailUserProperty = null;
try
{
    mailUserProperties = mail.UserProperties;
    mailUserProperty = mailUserProperties.Add("TestUserProperty", 
       Outlook.OlUserPropertyType.olText);
    mailUserProperty.Value = "test123";
    mail.Save();
}
catch
{
}
finally
{
    if (mailUserProperty != null) Marshal.ReleaseComObject(mailUserProperty);
    if (mailUserProperties != null) Marshal.ReleaseComObject(mailUserProperties);
}

然后,如果电子邮件已通过 Exchange 发送,在收件人的系统上获取其 TestUserProperty 仍会返回 test123,因此该属性与收件人共享。 SMTP 不会发生这种情况。

那么,有没有办法 (a) 创建一个不与收件人共享的用户属性,或者 (b) 一些完全不同的方法将数据附加到 Outlook.MailItem 这是没有分享?

最佳答案

为什么不在发送消息时删除用户属性(Application.ItemSend)?

关于c# - 共享 Outlook MailItem UserProperties,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25887854/

相关文章:

c# - 如何从 Outlook 获取最新邮件

c# - 空的 Outlook 加载项会导致立即崩溃

c# - Global.asax 中 FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters) 的目的是什么

c# - 如何在 IQueryable<> 中选择日期间隔?

c# - 表达式引用了不属于 ISearchIndexClient.Documents.Search 方法的模拟对象的方法

vba - 在 Outlook 中收到新邮件后如何触发宏运行?

css - VSCode 为所有 mso 属性抛出错误...?

c# - 在 Excel VSTO 中,如何检查工作表是否属于已关闭的工作簿?

vsto - 在 PowerPoint 中访问事件幻灯片/访问幻灯片上的事件形状 - VSTO

c# - 访问父类(super class)成员