Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access to other user's calendar in Office 365 API

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.

like image 292
MarcusMaker Avatar asked Sep 13 '14 07:09

MarcusMaker


People also ask

How do I view another person's calendar in Office 365?

In Calendar, on the Home tab, in the Manage Calendars group, click Open Calendar, and then click Open Shared Calendar. Type a name in the Name box, or click Name to select a name from the Address Book. The shared Calendar appears next to any calendar that is already in the view.

How do I give access to another user's calendar?

First, open Outlook, then from the left pane select a calendar you want to share or click the calendar icon on the bottom menu. In the Calendar view, go to the Home menu and under the Share group, click Share Calendar. In the Sharing invitation window, select users you want to share the calendar with.

How do I get calendar permissions in Office 365?

To view or configure calendar permissions, you open up user properties, select the Mailbox tab and click the Calendar Permissions button. This opens up the Calendar Permissions form, where you can view, add, remove or reconfigure permissions on the user calendar.


2 Answers

[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.

  • EWS Managed API download
  • Impersonation and EWS in Exchange
  • Working with impersonation by using the EWS Managed API

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

Thanks,

Venkat

like image 150
Venkat Ayyadevara - MSFT Avatar answered Oct 07 '22 01:10

Venkat Ayyadevara - MSFT


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);
    ...
}
like image 22
Dennis Shtemberg Avatar answered Oct 07 '22 00:10

Dennis Shtemberg