I would like to know how to get list of all the available free meeting rooms at specific time window using EWS managed API, say for example between 4pm-5pm on 20th October
-
1Take a loot at ExchangeService.GetUserAvailability Search for: Exchange 2013 101 Code Samples – McNets Oct 21 '16 at 18:02
-
Sorry, I have already gone through it, it didn't helped much. Problem with GetUserAvailability method is that you cant specify 1 hour Time window, its always days not hours (say 4pm-5pm of specific day). My requirement is very simple, all I want is, a simple search which gives me all the rooms which are free at specific time window of a particular day, i am not looking for the system to provide me Suggested Time. – user1233802 Oct 24 '16 at 05:09
-
You have two options in EWS to get this information GetUserAvailability or query each Meeting Room calendar directly using FindItems. Are the Rooms you want to query in a RoomList ? GetUserAvailability will give you want you want you just need to go through the results eg it gives available in 15 minutes increments across 24 hours so if you want to know 4-5pm you just need to read through the results. The only problem may be how many mailbox do you want to query? – Glen Scales Oct 25 '16 at 01:15
-
@user1233802 any progress on this ? – Jan 12 '18 at 14:50
1 Answers
I would suggest using GetUserAvailability. According to MSDN :
GetUserAvailability(IEnumerable, TimeWindow, AvailabilityData) method supports only time periods that are a minimum of 24 hours long and that begin and end at 12:00a.m.To restrict the results of the method to a shorter time period, you must filter the results on the client.
So if you are looking for free rooms today you may create TimeWindow object like this one:
new TimeWindow(DateTime.Today, DateTime.Today.AddDays(1))
For attendees you pass collection of AttendeeInfo, that should contains smtp addresses of the rooms you are looking for:
new List<AttendeeInfo>() { new AttendeeInfo("room1@example.com"),new AttendeeInfo("room2@example.com") };
For AvailabilityData, if you don't need suggestion it is better to pass AvailabilityData.FreeBusy, as the query would be lighter.
In the response you will find list of CalendarEvent that contains stat and end time of all meetings for today and you can check if there are any free rooms for the time range you want. You may find this post helpful in order to check if the requested time range overlaps any of the meetings.