使用OAuth2令牌将EWS API服务连接到outlook.com帐户 [英] Connecting with EWS API service to outlook.com account with oAuth2 token

查看:653
本文介绍了使用OAuth2令牌将EWS API服务连接到outlook.com帐户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用位于Outlook.com上URL的帐户通过live.com进行身份验证

I'm able to authenticate with live.com with my account on outlook.com at url

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

我收到一个accessToken和ID令牌.

I receive an accessToken and id token.

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

My question is whether I can use this accessToken to retrieve exchange data about my emails through EWS API service using this token? ExchangeService.

   _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")

通过Exchange服务的以下URL中的ExchangeService.asmx对Outlook 365进行身份验证,如以下

Authenticate to Outlook 365 through the ExchangeService.asmx in the following URL for exchange service as done in the following sample.

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

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

My question is whether I can retrieve email data from exchange service ASMX with the idToken/accessToken supplied from live.com for outlook.com accounts?

推荐答案

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

It seems like the retrieving of data with EWS Managed API is not supported with outlook.com accounts.

您可以在黄色部分中阅读(在黄色部分中)此处以及此处.

you can read (in the yellow section) about it here and also here.

基本上,今天有2个门户可以使用以下方式创建应用程序:

Basically, there are 2 portals today that apps can be created with:

  1. 应用程序注册门户网站
  2. Azure管理门户网站
  1. Application Registration portal
  2. Azure management portal

它指出,由于这些原因,不支持outlook.com帐户:

It states that for these reasons outlook.com accounts are not supported:

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

  1. New app registrations should be created and managed in the new Application Registration Portal to be compatible with Outlook.com. This means that if you have an app that was created thru Azure Management Portal it will not be supported with outlook.com and the token will not work with outlook.com accounts.

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

Existing app registrations that were created in the the Azure Management Portal will continue to work for Office 365 only

此外,如果您使用应用程序注册门户创建了应用程序,则在具有Exchange Online和仅一些 Outlook.com帐户的所有Office 365帐户中,目前已启用REST API.这意味着不能保证所有Outlook.com帐户都尚未迁移,因为它们尚未迁移.

Also if you created your app with Application Registration Portal The REST API is currently enabled on all Office 365 accounts that have Exchange Online and only some Outlook.com accounts. this means it is not guaranteed to all outlook.com accounts because they haven't migrated all of them (yet).

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

Microsoft accounts with Outlook.com mailboxes (including Outlook.com, Hotmail.com, Live.com, MSN.com, and Passport.com) are in the process of being upgraded to enable the REST APIs. During this process, making API calls to mailboxes that are not yet upgraded will return a MailboxNotEnabledForRESTAPI or MailboxNotSupportedForRESTAPI error code.

这篇关于使用OAuth2令牌将EWS API服务连接到outlook.com帐户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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