What would be the simplest way to display an Exhan

2020-03-31 17:28发布

问题:

What would be the simplest way to display an Exhange/Outlook meeting room's calendar on a webpage using Exchange Web Services?

There's no need to be able to book rooms, cancel meetings etc., only to display the meetings in a certain meeting room for the next 5 days.

Based on my research I think these could be pretty much what I need to use, I'm just not sure how to use these code examples in a webpage:

http://msdn.microsoft.com/en-us/library/office/dn439786%28v=exchg.80%29.aspx

or this:

Getting Room Appointments Efficiently from Exchange

Your answers, guidance would be much appreciated! Thank you!

回答1:

I would suggest using the FindAppointments() method in the EWS Managed API. It's designed to retrieve appointments from a calendar folder in a mailbox that fit within a certain date range, similar to the way Outlook displays a week of appointments at a time. You will need to make sure you are connected to the Exchange service with an account that has access to the meeting room's calendar. Here is a small example to get you started:

// Specify the date range to search and max items returned
CalendarView calView = new CalendarView(new DateTime(2014, 1, 10), new DateTime(2014, 1, 20), 10);

// Specify the properties to be returned
calView.PropertySet = new PropertySet(BasePropertySet.FirstClassProperties);

// Find the appointments
FindItemsResults<Appointment> results = service.FindAppointments(WellKnownFolderName.Calendar, calView);

Now that you have the appointments for the date range you want, you can take the information and bind them to your web page to be displayed however you like. For example, you could use a calendar control and display these appointments within specific days on the calendar. I don't have a full working example of this, but this article should help get you started:

How to: Customize Individual Days in a Calendar Web Server Control

I hope this helps. If this does resolve your question, please mark this post as answered.

Thanks,

--- Bob ---