0
votes

Building an android application to log in users to their outlook accounts and get their calendar events on their behalf.

We followed this tutorial and integrated this into the android application: https://github.com/Azure-Samples/active-directory-android

We successfully received an access token. now we are testing it with the API call we are interested in - https://outlook.office.com/api/v2.0/me/calendarview?startdatetime=2016-06-01T00:00:00Z&enddatetime=2016-06-02T00:00:00Z - for the users added in the same domain - (these are already added to the current tenant). We are getting a unexpected response when testing it out in the oAuth sandbox. PLEASE SEE ATTACHED SCREENSHOT.

What am I doing wrong? why am I not able to call the get calendar events API for the users?

Calling O365 get calendar events REST API fails

1
My first guess here is that the users' email isn't hosted on Office 365 servers. Is it possible these users's mailboxes are in on-premises Exchange servers?Jason Johnston
@JasonJohnston these are the users created in portal.azure.com itself. We are ultimately building this for office 365, so perhaps we should go ahead and create a test O365 instance and pull users for that?Ankan-Zerob
@JasonJohnston appreciate the help you are extending. Also even if we configure this O365 instance. this way we can allow only 1 corporate client to Outlook login, but how do we support multiple organizations?Ankan-Zerob
@JasonJohnston should we go about this answer you posted stackoverflow.com/questions/29069788/… or impersonation and EWS in stackoverflow.com/questions/25820915/…Ankan-Zerob
I wouldn't recommend using EWS for new apps at this point unless you have a compelling reason to do so, such as a requirement to support on-premises Exchange servers.Jason Johnston

1 Answers

1
votes

The error you're getting back is 404 Not Found, which basically means that user doesn't have a mailbox in Office 365 or Outlook.com. The additional info in the X-CasErrorCode: DomainNotFound header would indicate that the footaki.com domain's email isn't hosted by O365.

From your comments, it sounds like you're creating the users in the Azure portal without an Office 365 subscription. Those user's definitely won't work, there just isn't any calendar data present for the API to access!

Regarding multiple organizations: apps can definitely support multiple orgs. If you register in the Azure portal to get your client ID/secret, then there's a toggle labeled Application is multi-tenant that you need to turn on. If you registered in apps.dev.microsoft.com, those are multi-tenant by default.