且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用C#,ASP.NET从Exchange读取电子邮件

更新时间:2023-02-08 08:11:26

假设您的目标是Exchange 2007(如果不是,则可能需要考虑使用 WebDAV ,但我无法帮助你):

通过EWS托管API ,您可以通过执行操作轻松阅读其他用户的邮箱以下内容:


Assuming you are targeting Exchange 2007 (if you are not, you may want to consider using WebDAV, but I can't help you much with it):

Using the Exchange Web Services via the EWS Managed API, you can read other users' mailboxes very easily, by doing the following:

ExchangeService service = new ExchangeService();
service.Credentials = new WebCredentials("username", "pwd");
service.AutodiscoverUrl("usertoaccess@contoso.com");

FindItemsResults<Item> findResults = service.FindItems(new FolderId(WellKnownFolderName.Inbox, "usertoaccess@contoso.com"), new ItemView(10));

foreach (Item item in findResults)
{
    // Do something with the item
}

>