更改Outlook MailItem图标 [英] change outlook MailItem icon

查看:162
本文介绍了更改Outlook MailItem图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个Outlook 2010插件,当用户单击菜单中的一个按钮时,该插件会将电子邮件导出到特定位置.

I'm developing an outlook 2010 addin that exports the emails to a specific locations when an user clicks a button from the menu.

这不是问题,但是如果导出成功,我还需要更改MailItem图标象形图.我试图寻找解决方案,但我只知道需要使用表单区域 ,但我没有找到真正有用的解决方案.

This part is not a problem, but I need also to change the MailItem icon-pictogram if the export was successful. I tried to look for solutions, but I only get that I need to use form regions , but I didn't find a true helpful solution.

有什么想法我应该如何使用此表单区域?!

Any ideas how should I use this form regions?!

我完成了该加载项,从VS 2010进行调试时,一切似乎都可以正常工作.我还创建了一个安装程序,但是在安装该应用程序后,Outlook不会像我想要的那样显示我的图标.它没有显示上面的内容,而是更改了图标,但显示了默认图标-不是我的.图标位于我使用的FormRegion的resx文件中(我使用dor default并从清单中读取图标),我还尝试将它们移动到常规Resource文件(Properties.Resource)中,但是结果是相同的.有人可以帮我吗?

I finished the add-in and everything seems to work perfect when debugging from VS 2010. I also created an installer, but after installing the application the Outlook won't display my icons like I want. Instead of showing what you can see above, it changes the icons, but shows a default one - not mine. The icons are in the resx file from the FormRegion that I used (I use dor default and read icons from manifest) , I also tried to move them to the general Resource file (Properties.Resource), but the result is the same. Can someone help me with this?

因此,我还使用Replacement和ReplaceAll添加了一个FormRegion,在清单的默认图标上添加了我的图标,并将其命名为IPM.Note.MyExportedItem.

So I added a FormRegion using Replacement and ReplaceAll also, added my icon on default icon on manifest, and name it IPM.Note.MyExportedItem.

在ThisAddin.cs中,我有以下代码:

In the ThisAddin.cs I have the following code:

MailItem mailItem =(selectedItem作为MailItem);

MailItem mailItem = (selectedItem as MailItem);

                    itemGuid = mailItem.EntryID;
                    string name = mailItem.Subject + ".msg";



                    name = "C:\\" + name.Replace(":", "");
                    try
                    {
                        mailItem.SaveAs(name, OlSaveAsType.olMSG);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString());
                    }
                    mailItem.MessageClass = "IPM.Note.MyExportedItem";
                    mailItem.Display(true);

                    ........

但是,当我按自己的意愿导出图标时,这不会将mailItem(电子邮件)图标从收件箱更改为我的图标,唯一可以看到的更改是当我调用Display(true)并打开邮件时信息.另外,如果我按新建项目",选择表单",然后打开表单区域",它会打开一个撰写邮件窗口,如果我向我发送电子邮件,那么它将带有我的图标...很奇怪...您可以在图片中看到:-)你知道我在做什么错吗?

But this is not changing the mailItem (email message) icon from Inbox for example to my icon when I export them like I want, the only change that I can see is when I call Display(true) and it opens the mail message. Also if I press New Items, Choose Form and I open my Form Region, it opens a compose message window and if I send an email to me, then it will have my icon...strange...you can see in the picture :-) Do you have any idea what I am doing wrong?

致谢

推荐答案

以下是在Outlook中使用自定义图标所需的步骤:

  1. 您需要分配自定义 MailItem.MessageClass ( IPM.Note.MyCompany.MyExportedItem )导出的项目.
  2. 创建与MessageClass匹配的替换表单区域
  3. 表单区域设计器的属性窗格.
  4. 使用自定义表单重新部署VSTO加载项地区.
  1. You need to assign a custom MailItem.MessageClass (IPM.Note.MyCompany.MyExportedItem) to your exported items.
  2. Create a replacement Form Region matching the MessageClass
  3. Assign the Icons in the Properties Pane of the Form Region Designer.
  4. Re-deploy your VSTO Add-In with the Custom Form Region.

MSDN论坛帖子还介绍了该过程.

这篇关于更改Outlook MailItem图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆