Reputation: 5021
I'm trying to work with EWS Managed API
to get the meeting room list,
and for each room to see the appointment list for a week.
I saw Get room lists by using EWS in Exchange And Get appointments and meetings by using EWS in Exchange
I've test the first link and I get 0 rooms.
Also for second link it gave the current user calendar but not meeting.
I need 3 things:
1) Get the meeting room list in my organization.
2) Get the meeting calendar for each room (for X days).
3) For each meeting, who organizes the meeting.
I cannot find the API for getting this information.
Upvotes: 2
Views: 4354
Reputation: 5021
After a lot of searching and thanks to this post I found an answer to question #1 and #2
1) For getting all the meeting room in your organization:
string filter = "(&(objectClass=*)(msExchRecipientDisplayType=7))";
//Assembly System.DirectoryServices.dll
DirectorySearcher search = new DirectorySearcher(filter);
List<AttendeeInfo> rooms = new List<AttendeeInfo>();
foreach (SearchResult result in search.FindAll())
{
ResultPropertyCollection r = result.Properties;
DirectoryEntry entry = result.GetDirectoryEntry();
// entry.Properties["displayName"].Value.ToString() will bring the room name
rooms.Add(new AttendeeInfo(entry.Properties["mail"].Value.ToString().Trim()));
}
2) Get the meeting calendar for each room (for 2 days):
List<AttendeeInfo> attend = new List<AttendeeInfo>();
foreach (AttendeeInfo inf in rooms)
{
attend.Clear();
attend.Add(inf.SmtpAddress);
AvailabilityOptions options = new AvailabilityOptions();
options.MaximumSuggestionsPerDay = 48;
// service is ExchangeService object contains your authentication with exchange server
GetUserAvailabilityResults results = service.GetUserAvailability(attend, new TimeWindow(DateTime.Now, DateTime.Now.AddDays(2)), AvailabilityData.FreeBusyAndSuggestions, options);
foreach (AttendeeAvailability attendeeAvailability in results.AttendeesAvailability)
{
Console.WriteLine();
Console.WriteLine();
if (attendeeAvailability.ErrorCode == ServiceError.NoError)
{
foreach (Microsoft.Exchange.WebServices.Data.CalendarEvent calendarEvent in
attendeeAvailability.CalendarEvents)
{
Console.WriteLine("Calendar event");
Console.WriteLine(" Starttime: " + calendarEvent.StartTime.ToString());
Console.WriteLine(" Endtime: " + calendarEvent.EndTime.ToString());
if (calendarEvent.Details != null)
{
Console.WriteLine(" Subject:" + calendarEvent.Details.Subject);
}
}
}
}
}
About question #3, it's not simple to get this information because it's private information and as regular user you don't have a permission to see it.
Upvotes: 6