您的位置:首页 > 编程语言

Outlook 2010 用代码在Outlook explorer中选中一个邮件

2011-11-22 16:36 417 查看
这个代码只能在Outlook 2010中使用

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Office.Tools.Ribbon;
using Outlook = Microsoft.Office.Interop.Outlook;
using System.Windows.Forms;
namespace OutlookAddIn18
{
public partial class Ribbon1
{
private void Ribbon1_Load(object sender, RibbonUIEventArgs e)
{

}

private void button1_Click(object sender, RibbonControlEventArgs e)
{
Outlook.Application app = Globals.ThisAddIn.Application;
Outlook.Explorer exp = app.ActiveExplorer();
Outlook.MailItem item = app.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox).Items[3];
exp.ClearSelection();
exp.AddToSelection(item);
}
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: