获得从Outlook未读邮件 [英] Get unread Mails from Outlook

查看:221
本文介绍了获得从Outlook未读邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有什么办法让从特定文件夹中的所有邮件到我的应用程序?

Is there any way to get all mail from an specific Folder into my Application?

推荐答案

选中此链接介绍到Outlook编程将解释东西更清楚。

Check this link. Introduction to Outlook Programming will explain things more clearly.

您可以通过mailitems循环。样品code

You could loop through the mailitems. Sample code

using System.Runtime.InteropServices;
using OutLook = Microsoft.Office.Interop.Outlook;
using Office = Microsoft.Office.Core;

    OutLook.Application oApp;
             OutLook._NameSpace oNS;
             OutLook.MAPIFolder oFolder;
             OutLook._Explorer oExp;

             oApp = new OutLook.Application();
             oNS = (OutLook._NameSpace)oApp.GetNamespace("MAPI");
             oFolder = oNS.GetDefaultFolder(OutLook.OlDefaultFolders.olFolderInbox);
             oExp = oFolder.GetExplorer(false);
             oNS.Logon(Missing.Value, Missing.Value, false, true);

        OutLook.Items items = oFolder.Items;
        foreach (OutLook.MailItem mail in items)
                        {

                            if (mail.UnRead == true)
                            {
                        }
        }

编辑: 参考其他文件夹

oFolder.Folders["Foldername"]

的OutLook code

常见的Outlook任务

这篇关于获得从Outlook未读邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆