如何在 C# 中读取另一个用户的 outlook 365 邮件

How to read another user outlook 365 mail in c#

我已经使用 o365 api 客户端 library.I 将一个 asp.net Web 应用程序与 office 365 邮件集成在一起 library.I 有一个特定的要求,假设我已经将其他用户的 o365 邮件 ID 存储在我的 database.The o365 邮件用户名/密码也存储在我的本地数据库中。有没有办法使用邮件 ID/凭据查看其他用户的邮件详细信息? 如果有人有任何想法,请分享。

提前致谢。

如果您的应用程序使用 OAuth 代码流,似乎只允许访问属于经过身份验证的用户的邮件、日历和联系人。您可以使用 OAuth2 client credential flow, for your scenario and the app will be able to make calls to interact with any mailboxes in that tenant. Another choice is to use EWS Managed API ,因为您获得了其他用户的密码,您将获得如下凭证:

  ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
  service.Credentials = new WebCredentials("user_with_access@example.com", "password");

检查 this thread 以获得演示。