0
用c#; 我能够使用具有的access_token本地应用产生的请求EWS托管API办公室365 我想使用带有的access_token网络应用产生。这是失败在service.AutodiscoverUrl('mailid', delegate(string url){return true})
并获得错误'自动发现服务找不到。'。如何将Web应用程序与EWS托管API用于Office 365?
我正在使用以下代码使用Web应用程序生成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应用程序与EWS托管API的办公室365或它是有限的本机应用程序?
'service.AutodiscoverUrl( 'mailid',委托(字符串URL){返回true})'这工作,如果我使用本机应用程序。 –
然后启用跟踪并查看正在发送的头文件之间的区别,这些头文件将立即告诉您发生了什么以及发生了什么问题。 –
谢谢,与网络应用程序;我只为'应用程序权限'生成access_token。现在可以使用access_token进行EWS请求。 –