7

I'm building a WPF-app that's doing a summary of several user's calendar in the organization. The Company is using Office 365 so I thought that the Office 365 API would be the best way to go.

I've managed to access my own calendar, but I don't know how to access my colleagues' calendars. Is it possible? I also need to list the GAL in order to pick which users I wolud like to include in the summary.

Cœur
  • 37,241
  • 25
  • 195
  • 267
MarcusMaker
  • 73
  • 1
  • 4

2 Answers2

9

[UPDATE] Service account support is available now for REST APIs. Please see Building Daemon or Service Apps with Office 365 Mail, Calendar, and Contacts APIs (OAuth2 client credential flow) for more info.

Thanks for your question and interest in Office 365 APIs! Currently, you can use the Office 365 API to access the authenticated user's calendar but not another user's calendar. Enabling a service account to be authorized to access mail/calendar/contacts of multiple users within an organization or the entire organization is on our roadmap and is prioritized pretty high, so stay tuned.

In the mean time, you can use Exchange Web Services (EWS) Managed API to implement your application. However, with EWS app impersonation, the service account has read/write access to the user's entire mailbox, and not just the calendar. Once we add support for service accounts in Office 365 API, you will be able to use OAuth and scope down the access of the app to only read a user's calendar.

Here are a few links explaining how EWS app impersonation works.

Please let me know if you have any questions or need more info.

Thanks,

Venkat

Venkat Ayyadevara - MSFT
  • 2,850
  • 1
  • 14
  • 11
  • 2
    Any updates with the API's access to another user's calendar? – Serge Jan 14 '16 at 22:35
  • @venkat any updates on this? are we able to access other user's calendar? – Ankan-Zerob May 22 '16 at 11:03
  • Not yet, sorry. This is still being worked on. Thanks. – Venkat Ayyadevara - MSFT May 24 '16 at 02:55
  • Is there any update on the OAuth way of scoping access? Would be pretty nifty to assure useres that an Application verifiably only accesses their Calendar OR Mail OR Contacs (or whatever conbimantion) – knechtrootrecht Jul 07 '16 at 08:17
  • Will it (or similar fine grained access definitions) be avialable for accesing in an On-Premise Exchange via EWS? – knechtrootrecht Jul 07 '16 at 08:53
  • @ivo You can scope app-only access to specific permissions such as Calendar.Read or Mail.ReadWrite. This is already supported. Let me know if you are having trouble setting this. No, the fine-grained access isn't available for accessing on-premises Exchange via EWS, since EWS only supports full-mailbox access. – Venkat Ayyadevara - MSFT Jul 22 '16 at 12:55
  • @venkat I would have been in need of this kind of access for EWS due to privacy reasons. So EWS is a no go atm. – knechtrootrecht Jul 27 '16 at 12:50
3

Yes, it is possible with Basic Authentication (but not with OAuth2). Plus your account must have Read access to your colleagues' calendars (can be done by an admin by setting mailbox folder permissions).

var authClearText = string.Format("{0}:{1}", yourEmail, yourPassword);
var authEncoded = Convert.ToBase64String(Encoding.Default.GetBytes(authClearText));
var authHeaderValue = "Basic " + authEncoded;

using (var httpClient = new HttpClient())
{
    httpClient.DefaultRequestHeaders.Add("Authorization", authHeaderValue);
    ...
}