【问题标题】:Connecting with EWS API service to outlook.com account with oAuth2 token使用 oAuth2 令牌将 EWS API 服务连接到 outlook.com 帐户
【发布时间】:2017-10-28 17:27:53
【问题描述】:

我可以使用我在 outlook.com 上的帐户在 url 上通过 live.com 进行身份验证

https://login.microsoftonline.com/common/v2.0

我收到一个 accessToken 和 id 令牌。

我的问题是我是否可以使用 this accessToken 通过 EWS API 服务使用此令牌检索有关我的电子邮件的交换数据?交换服务。

   _exchangeService = new ExchangeService(ExchangeVersion.Exchange2007_SP1) { ConnectionGroupName = Guid.NewGuid().ToString() };
                    _exchangeService.Credentials = new WebCredentials("xxxxxxx", "xxxxxxxx", "outlook.com");
                 //  _credentials = new OAuthCredentials(user.PasswordToken);
                    // Set the URL.
                    _exchangeService.TraceEnabled = true;
                    _exchangeService.AutodiscoverUrl("xxxxx")

通过以下 URL 中的 ExchangeService.asmx 向 Outlook 365 进行身份验证,以获取 Exchange 服务,如以下 sample 中所做的那样。

> https://outlook.office365.com/EWS/Exchange.asmx

我的问题是我是否可以使用 live.com 为 outlook.com 帐户提供的 idToken/accessToken 从交换服务 ASMX 检索电子邮件数据?

【问题讨论】:

    标签: outlook openid exchangewebservices


    【解决方案1】:

    似乎使用 EWS 托管 API不支持使用 Outlook.com 帐户检索数据。

    您可以阅读(在黄色部分)herehere

    现在基本上有 2 个门户可以用来创建应用:

    1. Application Registration portal
    2. Azure management portal

    声明由于这些原因,outlook.com 帐户不受支持:

    1. 应在新的应用程序注册门户中创建和管理新的应用程序注册,以与 Outlook.com 兼容。这意味着,如果您的应用是通过 Azure 管理门户创建的,则 outlook.com 将不支持该应用,并且该令牌不适用于 outlook.com 帐户。

    2. 在 Azure 管理门户中创建的现有应用注册将继续仅适用于 Office 365

    3. 此外,如果您使用应用程序注册门户创建了应用,则当前在所有具有 Exchange Online 的 Office 365 帐户和仅部分 Outlook.com 帐户上启用 REST API。这意味着不能保证所有 outlook.com 帐户都可以使用,因为它们尚未迁移所有帐户。

    4. 具有 Outlook.com 邮箱(包括 Outlook.com、Hotmail.com、Live.com、MSN.com 和 Passport.com)的 Microsoft 帐户正在升级以启用 REST API。在此过程中,对尚未升级的邮箱进行 API 调用将返回 MailboxNotEnabledForRESTAPI 或 MailboxNotSupportedForRESTAPI 错误代码。

    【讨论】:

      【解决方案2】:

      我相信 EWS 仍然适用于具有 BASIC(用户名、密码)身份验证的 Outlook.com 帐户。在迁移到 Graph API 之前,我们曾经使用过它。不过,您需要让 Outlook 用户生成一个特殊的 App Password

      要简化您的 Exchange/Outlook 集成,请查看 Aurinko API

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2020-03-07
        • 2020-05-18
        • 2021-12-14
        • 1970-01-01
        • 1970-01-01
        • 2018-08-24
        • 2019-11-05
        • 2016-06-25
        相关资源
        最近更新 更多