I'm developing an Android App that will manage bookings for a few Outlook meeting rooms (users). The idea is just to display their availability and book a room for a certain amount of time.
So far I have had success getting the events just on my own calendar using Outlook SDK Android.
// logon() {
...
mResolver = new DependencyResolver.Builder(
new OkHttpTransport().setInterceptor(new LoggingInterceptor()),
new GsonSerializer(),
new AuthenticationCredentials() {
@Override
public Credentials getCredentials() {
return new OAuthCredentials(
authenticationResult.getAccessToken()
);
}
}).build();
// onCreate() {
Futures.addCallback( logon(), new FutureCallback<Boolean>() {
@Override
public void onSuccess(Boolean result) {
mClient = new OutlookClient(outlookBaseUrl, mResolver);
getCalendars();
}
@Override
public void onFailure(Throwable t) {
Log.e("logon", t.getMessage());
}
});
...
protected void getCalendars() {
DateTime startDate = new DateTime(
DateTime.parse("2016-02-05T00:00:00Z"));
DateTime endDate = new DateTime(
DateTime.parse("2016-02-06T00:00:00Z"));
Futures.addCallback(
mClient.getMe()
.getCalendarView()
.addParameter("startDateTime", startDate)
.addParameter("endDateTime", endDate)
.read(),
new FutureCallback<OrcList<Event>>() {
@Override
public void onSuccess(final OrcList<Event> result) {
runOnUiThread(new Runnable() {
@Override
public void run() {
StringBuilder sb = new StringBuilder();
ListIterator<Event> events =
result.listIterator();
while (events.hasNext()) {
Event event = events.next();
sb.append(event.getSubject() + "\n");
}
messagesTextView.setText(sb.toString());
}
});
}
@Override
public void onFailure(Throwable t) {
Log.e("Calendar error", t.getLocalizedMessage());
}
}
);
}
Or in alternative using getUsers() instead of getMe(): see here.
So now next steps are:
Do I need an admin user even just to read the meeting rooms calendar or there's some other way?
If I won't be allowed to use an admin account can I manage multiple users with a good usability / performance relying on Oauth flow?
I'm new to Android, is it easier to deal with Outlook REST API or Microsoft Graph?
Thanks
Today you need to use client credentials flow (AppOnly) if you want your app to access other user's calendar. We are working on an API that will allow to get availability information, more details soon.
Using the OAuth flow you get an access token and a refresh token, the access token is valid for a short period of time and the refresh token can be used to generate new access tokens. The tokens are per user, you basically store the refresh tokens in your app on a per user cache.
From the platform perspective it is the same to interact with the individual Outlook endpoint or the Microsoft Graph. If you app wants to access more than calendar information, like user profile or files, then using Microsoft Graph is the recommendation as you can access data from multiple services under a single endpoint and with a single access token.