Using C#, I’m trying to query the currently logged in user’s free/busy time for the day and present them with a list of free blocks of time according to their calendar. Microsoft provides the following example with limited guidance: http://msdn.microsoft.com/en-us/library/office/aa494212(v=exchg.140).aspx
I’m trying to utilize this example but I am unable to get the ExchangeServiceBinding (among other objects) to be a recognized object. I have installed the EWS Managed API 2.0 and added a reference to (and using statement for) Microsoft.Exchange.WebServices. Still missing a lot of references for the objects used in Microsoft’s example above. Any thoughts?
I’m not married to this particular guide. My goal is pretty straightforward. I’m happy to entertain other approaches or suggestions.
You should create a ExchangeService object.
this.exchangeService = new ExchangeService(ExchangeVersion.YOURVERSION, TimeZoneInfo.FindSystemTimeZoneById("YOURTIMEZONE"));
this.exchangeService.Credentials = //your credentials, or use impersonation
this.exchangeService.Url = //exchange server uri;
this.exchangeService.PreAuthenticate = true;
On the ExchangeService object you should be able to call GetUserAvailability().
1
Updated answer for 2023 – Use the Microsoft Graph API. For App-level access you can call calendar-getSchedule
for all the events in a users calendar: https://learn.microsoft.com/en-us/graph/api/calendar-getschedule?view=graph-rest-1.0&tabs=http
For delegated access you can call findMeetingTimes
with a list of users(just as office does when you are trying to arrange a meeting with others): https://learn.microsoft.com/en-us/graph/api/user-findmeetingtimes?view=graph-rest-1.0&tabs=http