如何在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 也不会以任何方式解析它,也不会使用它来显示任何类型的图像。
我想在 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 也不会以任何方式解析它,也不会使用它来显示任何类型的图像。