【发布时间】:2016-04-29 12:31:50
【问题描述】:
用 c#;
我可以使用 native app 生成的 access_token 来请求 Office 365 的 EWS 托管 api。
我正在尝试使用 web app 生成的 access_token。这在 service.AutodiscoverUrl('mailid', delegate(string url){return true}) 失败并出现错误“找不到自动发现服务。”。
我正在使用以下代码使用网络应用程序生成 access_token。
string authority = "https://login.windows.net/common/oauth2/authorize";
string serverName = "https://outlook.office365.com";
AuthenticationContext authenticationContext = new AuthenticationContext(authority, false);
ClientCredential credential = new ClientCredential("Web app client id", "Web app secret key");
AuthenticationResult authenticationResult = authenticationContext.AcquireToken(serverName, credential);
authenticationResult.AccessToken; // read access_token here.
我可以将 Web 应用程序与 Office 365 的 EWS 托管 API 一起使用吗?或者它仅限于原生应用程序?
【问题讨论】:
标签: c# oauth office365 exchangewebservices