繁体   English   中英

如何在Outlook自定义列中添加位图图像

[英]How to add bitmap image in outlook custom column

我想在Outlook视图中添加自定义图像列。 这是我添加自定义图标的示例代码。

   Outlook.Explorer explorer = this.Application.ActiveExplorer();
                Outlook.Selection selection = null;
                try { selection = explorer.Selection; }
                catch { }
                if (selection != null && selection.Count > 0)
                {
                    object item = selection[1];
                    if (item is Outlook.MailItem)
                    {
                        Outlook.MailItem mail = item as Outlook.MailItem;
                        Outlook.UserProperties userProperties = mail.UserProperties;
                        Outlook.UserProperty userProperty = userProperties.Add("SyncStatus", Outlook.OlUserPropertyType.olEnumeration, true, Outlook.OlFormatEnumeration.olFormatEnumBitmap);
                        userProperty.Value = new Bitmap(@"...\icons\Sync.ico");
                        mail.Save();
                        Marshal.ReleaseComObject(userProperty);
                        Marshal.ReleaseComObject(userProperties);
                    }
                    Marshal.ReleaseComObject(item);
                    Marshal.ReleaseComObject(selection);
                }

错误:XXXXXX.dll中发生类型'System.Runtime.InteropServices.COMException'的异常,但未在用户代码中处理

附加信息:不支持数据类型。

请建议如何在Outlook中添加图像列。

你不能这样做。 即使可以添加二进制数据,Outlook也不会以任何方式解析它,也不会使用它显示任何类型的图像。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM