With c#;
I am able to use access_token generated with native app to request EWS managed api for office 365.
I am trying to use access_token generated with web app. This is failing at service.AutodiscoverUrl('mailid', delegate(string url){return true})
and getting error 'The Autodiscover service couldn't be located.'.
I am using following code to generate access_token using web app.
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.
Can I use Web App with EWS managed API for office 365 or it is limited t native app?