Outlook Interop库不仅用于加载项。例如,它可用于编写仅读取您所有Outlook联系人的控制台应用程序。我非常确定标准的Microsoft Outlook Interop库将允许您阅读邮件-尽管它可能会在Outlook中引发安全提示,用户必须单击该提示。
:实际使用Outlook Interop实现邮件阅读取决于您对“独立”的定义。Outlook Interop库要求在客户端计算机上安装Outlook才能正常运行。
// Dumps all email in Outlook to console window.
// Prompts user with warning that an application is attempting to read Outlook data.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Outlook = Microsoft.Office.Interop.Outlook;
namespace OutlookEmail
{
class Program
{
static void Main(string[] args)
{
Outlook.Application app = new Outlook.Application();
Outlook.NameSpace outlookNs = app.GetNamespace("MAPI");
Outlook.MAPIFolder emailFolder = outlookNs.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderIn@R_739_2419@);
foreach (Outlook.MailItem item in emailFolder.Items)
{
Console.WriteLine(item.SenderEmailAddress + " " + item.Subject + "\n" + item.Body);
}
Console.ReadKey();
}
}
}