C#操作Outlook

//引用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);//接收时间
        }

C#操作Outlook

上一篇:Win10 配置 tensorflow


下一篇:ElasticSearch之安装及基本操作API