Outlook 2010遍历会话相关的所用邮件
2011-11-28 16:49
260 查看
这个例子使用C#,Visual Studio 2010开发,是基于Outlook 2010的应用。当你选中一个邮件然后在Ribbon上点击按钮后所用与这个会话相关的邮件都会被打开。
主要代码:
主要代码:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.Office.Tools.Ribbon; using Outlook = Microsoft.Office.Interop.Outlook; namespace GetConversationMails { public partial class Ribbon1 { private void Ribbon1_Load(object sender, RibbonUIEventArgs e) { } private void button1_Click(object sender, RibbonControlEventArgs e) { Outlook.Application objApplication = Globals.ThisAddIn.Application; Outlook.Explorer objExplorer = objApplication.ActiveExplorer(); for (int i = 0; i <= objExplorer.Selection.Count; i++) { if (i > 0) { var obj = objExplorer.Selection[i]; if (obj is Outlook.MailItem) { Outlook.MailItem objMailItem = (Outlook.MailItem)obj; Outlook.Conversation objConversation = objMailItem.GetConversation(); Outlook.SimpleItems objRootItems = objConversation.GetRootItems(); objExplorer.ClearSelection(); foreach (var Element1 in objRootItems) { if (Element1 is Outlook.MailItem) { Outlook.MailItem objRootItem = (Outlook.MailItem)Element1; //对根邮件的处理。这里的示例为在Inspector中显示。 objRootItem.Display(); Outlook.SimpleItems objChildrenItem = objConversation.GetChildren(objRootItem); foreach (var Element2 in objChildrenItem) { if (Element2 is Outlook.MailItem) { Outlook.MailItem objChildItem = (Outlook.MailItem)Element2; //对子邮件的处理,这里的示例为在Inspector中显示。 objChildItem.Display(); } } } } } } } } } }相关资源下载:http://download.csdn.net/detail/tx_officedev/3853114
相关文章推荐
- Outlook 2010遍历会话相关的所用邮件
- Outlook 2010 用代码在Outlook explorer中选中一个邮件
- 恢复Outlook 2010/2007已被删除邮件的方法
- [office冰激凌]通过样式设置Outlook 2010 新邮件的行距
- OutLook 2010 (Bata) 中的邮件导出功能
- Microsoft Outlook 2010客户端连接outlook.com邮箱收发邮件
- outlook 2010邮件传输接口错误解决一例
- outlook 2010 邮件模板使用
- Outlook 2010 与Google产品的同步相关软件
- 备份Outlook 2010邮件账户信息
- 开启从Lotus 邮件系统到Exchange 系统的转移篇章-POC过程- 修改Exchange 2010 相关设定!
- SharePoint 2010 托管元数据Bug (跟邮件提醒功能相关.小bug,大问题)
- 基于Windows Azure 搭建基于SharePoint 2010 Intranet、Extranet、Internet (4): 配置传出邮件服务: 使用 outlook.com 发送邮件通知
- Outlook 2010 中查看邮件头
- office 2010/账户配置POP方是收取邮件,服务器上保留副本,收取一遍完成后,按F9,OUTLOOK重复收所有
- 通过OutLook 2010 找回误删除的邮件
- Outlook 2010关于邮件授权代理访问的问题
- 基于Windows Azure 搭建基于SharePoint 2010 Intranet、Extranet、Internet (4): 配置传出邮件服务: 使用 outlook.com 发送邮件通知
- OutLook 2010 收件箱子文件夹收到新邮件时没有桌面通知
- Outlook 2010 中查看邮件头