简体   繁体   English

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

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

I want to add custom image column in outlook view. 我想在Outlook视图中添加自定义图像列。 This is my sample code to add custom icon. 这是我添加自定义图标的示例代码。

   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);
                }

Error: An exception of type 'System.Runtime.InteropServices.COMException' occurred in XXXXXX.dll but was not handled in user code 错误:XXXXXX.dll中发生类型'System.Runtime.InteropServices.COMException'的异常,但未在用户代码中处理

Additional information: Data type is not supported. 附加信息:不支持数据类型。

Please suggest how can i add image column in outlook. 请建议如何在Outlook中添加图像列。

You cannot do that. 你不能这样做。 Even though you can add binary data, Outlook does not parse it in any way and will not use it to show any kind of an image. 即使可以添加二进制数据,Outlook也不会以任何方式解析它,也不会使用它显示任何类型的图像。

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

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