高分求助,不够可以再开贴,Outlook AddIns,怎样修改选定Email的图标。

jimh 2011-05-17 09:14:46
如题,使用C#,选中一条Email,然后点击一个自定义CommandButton,可以响应,也可以读取选中的那条MailItem的属性,但就是无法修改这条MailItem的图标.


Outlook.MailItem mail = Application.ActiveExplorer().Selection[1] as Outlook.MailItem mail.PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/proptag/0x10800003", 1); mail.FormDescription.Icon = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"ToolbarIcons\setup.ico"); mail.FormDescription.MiniIcon = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"ToolbarIcons\setup.ico"); mail.Save(); //refresh item for display


以上代码可以修改图标,但修改的图标是Outlook自带的图标,不是我指定的setup.ico图标
网上搜索,发现需要修改mail.MessageClass属性,但不知道如何修改,请高人指教。

从window专区转过来,那边没人气,都没人回答。
...全文
214 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
jimh 2011-05-24
  • 打赏
  • 举报
回复
顶,不要沉!!
kingdom_0 2011-05-23
  • 打赏
  • 举报
回复
If you customize one of the default Outlook forms and then publish it to a folder or forms library, the name given at that time is appended to the standard message class for that item type to create a unique message class for that form. For example, if you customize a contact form, publish it, and name it MyForm, the message class for the published form will be IPM.Contact.MyForm. Any new items that use this custom form will have their message class field set to IPM.Contact.MyForm (see Figure 4).
If MyForm is published to the Contacts folder, then under the Actions menu, you will have a New MyForm option. This will create a new contact item and its message class will be set to IPM.Contact.MyForm. However, if you click on the New Contact toolbar button, you will get a new default Contact form. As we saw in the previous Try This, this is because the default form for the contact folder is still set to Contact. To change this:

1. Display the Properties for the Contacts folder (either point to Folder on the File menu, and then click Properties for "Contacts" or right-click the Contacts folder and click Properties).
2. In the When posting to this folder, use setting, select your custom form.
3. Click OK.

Note To return the default back to the Contact form, set the When posting to this folder, use setting back to Contact.

It is important to note that importing or exporting items through the Import/Export Wizard does not allow you to specify a message class for the new Outlook items. All of the new items are assigned the standard message class depending on the type of item being imported.

Note For a complete list of messages classes and how each one is used by Outlook, see the Item types and message classes topic in the Outlook Help file.

When working with custom forms, is is a good practice for you to always keep track of the message class fields. It is recommended that you add the message class field to the table view for your custom folders so that you can be sure that each item is actually using the proper form. To do this, click your custom folder and then:

1. Point to Current View on the View menu and then click Customize Current View.
2. Click Fields on the View Summary dialog box.
3. In the Select available fields from drop-down list, click the appropriate All <folder type> fields selection for the type of custom folder you created. For example, click All Contacts fields for a contact-type custom folder.
4. In the Available fields list, click Message Class, and then click the Add -> button.
5. In the Show these fields in this order list, click Message Class, and then click either Move Up or Move Down to position the field where desired.
6. Click OK.
kingdom_0 2011-05-23
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 jimh 的回复:]

http://msdn.microsoft.com/en-us/library/Aa155722 里面的内容有介绍怎样修改MessageClass,但还是不知道怎样编程修改MailItem的图标为指定的图标文件。这方面的资料太少了。
[/Quote]微软帮助文档都帮不了你,我估计这个问题很严重……
帮顶!
hellodujiqiang 2011-05-23
  • 打赏
  • 举报
回复
等一下我 我也帮顶啦
jimh 2011-05-23
  • 打赏
  • 举报
回复
看来无法解决问题了,先结贴,再开新贴,顶者有份。
jimh 2011-05-23
  • 打赏
  • 举报
回复
vba也可以啊,outlook对象是一样的,可以没多少人用过这个功能。我只是要扫描所有email,然后对符合规则的email做上标记(改图标),但这个标记就是无法标上。
jimh 2011-05-19
  • 打赏
  • 举报
回复
http://msdn.microsoft.com/en-us/library/Aa155722 里面的内容有介绍怎样修改MessageClass,但还是不知道怎样编程修改MailItem的图标为指定的图标文件。这方面的资料太少了。
DSIOF3KIDSKTR 2011-05-17
  • 打赏
  • 举报
回复
没有用过这个插件
wtj2832 2011-05-17
  • 打赏
  • 举报
回复
没做过,帮顶

110,500

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧