Platform SDK: CDO 1.2.1

Rendering a Calendar

A calendar is rendered under control of a ContainerRenderer object and a CalendarView object. The calendar view operates on a Messages collection in a calendar folder. The container renderer specifies the Messages collection in its DataSource property and the calendar view to be applied in its CurrentView property.

A calendar folder is usually obtained from the Session object's GetDefaultFolder method, with CdoDefaultFolderCalendar in the ObjectType parameter. The calendar folder is expected to contain only AppointmentItem objects in its Messages collection. Successful calendar rendering depends upon each appointment's StartTime and EndTime properties being set properly.

A calendar view is normally generated externally to a CDO application. The predefined common views are identified by "Daily" and "Weekly" in the Name property. You can also create a nonpersistent custom view with the Add method of the Views collection. A calendar view created in this way ceases to exist when the collection is released.

A calendar view bases its HTML output on the following display units:

The time unit is specified by the view's Mode property. The time span is expressed as a multiple of time units in the view's NumberOfUnits property. The size of the time slots is controlled by the view's Interval property. Time slots appear as a grid when the Mode property is set to CdoModeCalendarDaily.

The calendar view, which is subclassed from the TableView object, is structured using rows and columns. Each column of the view represents one day, and is rendered as a one-column-wide HTML table. Each cell in the table, at the intersection of a row and a column, displays one time slot.

AppointmentItem objects with their Duration property equal to an exact multiple of 24 hours are considered events; otherwise they are appointments. You can render appointments using the calendar view's RenderAppointments method and events with the RenderEvents method. Events also have their AllDayEvent property set to True.

You can allow the user to determine the starting date for rendering by calling the RenderDateNavigator method, which prepares HTML output for one or more months in traditional calendar format. The HTML page interacts with the user, who can select a date from a displayed month or move forward and backward through the months as necessary.

You can set properties on the calendar view to control the rendering of different types of cells. The BusyCell property specifies rendering for time slots that are busy, that is, those that are within the duration of an accepted appointment. The FreeBusinessCell and FreeNonBusinessCell properties determine the rendering of free time slots that are within or outside of business hours, respectively. Business hours are determined by the ContainerRenderer object's BusinessDayStartTime and BusinessDayEndTime properties, and business days by the BusinessDays property.

In a daily view, the RenderAppointments method renders a narrow vertical column, called the indicator bar, between the time slot column on the left and the appointments table on the right. The indicator bar is intended to make it easier for the user to envision the state of the calendar with respect to busy and free times. It can be rendered differently for different degrees of commitment of a time slot. You can set the various renderings of the indicator bar with the calendar view's FreeIndicator, TentativeIndicator, BusyIndicator, and OOFIndicator properties.