//引用Microsoft.Office.Interop.Outlook.dll
using Outlook = Microsoft.Office.Interop.Outlook;
using Microsoft.Office.Interop.Outlook;
Outlook.Application myOutlookApp = new Outlook.Application();
Outlook.NameSpace myNameSpace = myOutlookApp.GetNamespace("MAPI");
Outlook.MAPIFolder myFolderInbox = myNameSpace.GetDefaultFolder(OlDefaultFolders.olFolderInbox);//获取收件箱对象,如获取其他箱可在参数中控制
Outlook.MAPIFolder myFolder = myFolderInbox.Folders["APPLY"];//“APPLY”为收件箱下的一个文件夹
foreach (object item in myFolder.Items)//遍历邮件
{
var mi = item as Outlook.MailItem;
Console.WriteLine(mi.Subject);//邮件主题
Console.WriteLine(mi.CreationTime);//接收时间
}
原文地址:https://www.cnblogs.com/zhujie-com/p/12041586.html
时间: 2024-10-18 18:13:32