如何创建应用程序通过C#发送和接收为Outlook [英] how to create an application send and receive as outlook by c#

查看:86
本文介绍了如何创建应用程序通过C#发送和接收为Outlook的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何创建应用程序通过C#发送和接收为Outlook
例如:
如果是第一个,则应用程序将读取所有电子邮件,但如果是第二个,则应用程序将仅读取未读的邮件???

how to create an application send and receive as outlook by c#
example:
if it is the first, app will read all email, but if it is the second , app only read mail unread ???

推荐答案


开头 C#中的简单SMTP电子邮件发件人...控制台应用程序 [ ^ ]
http://www.c-sharpcorner.com /uploadfile/rmostafa/building-your-own-mail-client-using-C-Sharp/ [ http://www.dreamincode.net/forums/topic /57355-sending-e-mail-messages-using-c%23/ [
Start with
Simple SMTP E-Mail Sender in C#… Console application[^]
http://www.c-sharpcorner.com/uploadfile/rmostafa/building-your-own-mail-client-using-C-Sharp/[^]
http://www.dreamincode.net/forums/topic/57355-sending-e-mail-messages-using-c%23/[^]


使用Microsoft.Office.Interop.Outlook;

您可以读取/写入/删除Outlook的所有功能.


BY using Microsoft.Office.Interop.Outlook;

you can Read/Write/Delete all the feature of outlook.


private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            Outlook.MAPIFolder deletedFolder = this.Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderDeletedItems);
           deletedFolder.Items.ItemAdd += new Outlook.ItemsEvents_ItemAddEventHandler(DeletedItems_ItemAdd);

        }

        void DeletedItems_ItemAdd(object Item)
        {
            if (Item is Outlook.MailItem)
            {
                (Item as Outlook.MailItem).UnRead = false;
            }
            else if (Item is Outlook.AppointmentItem)
            {
                (Item as Outlook.AppointmentItem).UnRead = false;
            }
            else if (Item is Outlook.MeetingItem)
            {
                (Item as Outlook.MeetingItem).UnRead = false;
            }
            else if (Item is Outlook.ContactItem)
            {
                (Item as Outlook.ContactItem).UnRead = false;
            }
            else if (Item is Outlook.JournalItem)
            {
                (Item as Outlook.JournalItem).UnRead = false;
            }
            else if (Item is Outlook.TaskItem)
            {
                (Item as Outlook.TaskItem).UnRead = false;
            }
            else if (Item is Outlook.TaskRequestItem)
            {
                (Item as Outlook.TaskRequestItem).UnRead = false;
            }
            else if (Item is Outlook.PostItem)
            {
                (Item as Outlook.PostItem).UnRead = false;
            }
            else if (Item is Outlook.PostItem)
            {
                (Item as Outlook.PostItem).UnRead = false;
            }
        }


这篇关于如何创建应用程序通过C#发送和接收为Outlook的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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