SetOption Method (Session Object)

SetOption Method (Session Object)

Exchange Server 2003

Topic Last Modified: 2004-06-09

The SetOption method sets a calendar rendering option for the session.

objSession.SetOption(OptType, OptValue)


Required. The Session object.


Required. String. Selects the option by name.


Required. String. Contains the value to set the option to.

The calendar rendering options can be inspected with the GetOption method. A CDO Rendering application can use their values to set the corresponding properties of a ContainerRenderer object when the rendering application logs on to the session. The container renderer properties are used by the RenderAppointments, RenderDateNavigator, and RenderEvents methods of a CalendarView object to render calendar data. The CDO Rendering ObjectRenderer object can also use the value of the "TimeZone" option.

Note that the rendering objects do not automatically assimilate the values of the Session object's calendar rendering options. You must transfer these values yourself between the Session object and the appropriate properties of the rendering object you are using.

GetOption and SetOption return CdoE_CALL_FAILED if you call them while you are not logged on to the session. Following a successful logon, GetOption returns the option settings that were stored in the messaging user's Inbox with SetOption. If no options have ever been stored for the messaging user, the default settings are returned.

The "CalendarStore" option can be "Outlook" or "SchedulePlus", depending on the store underlying the messaging user's calendar folder. This option is useful if you have both types of calendar store and need to select between them. It defaults to "Outlook" if you have neither type or both types. Calendar store information is irrelevant to the container renderer, so "CalendarStore" has no corresponding rendering object property.

If you attempt to set the "CalendarStore" option to anything other than "Outlook" or "SchedulePlus", SetOption returns CdoE_INVALID_PATAMETER.

The "FreeBusyMonths" option can contain any positive integer greater than 1. It indicates how many months of the messaging user's free/busy information can be made available in response to a GetFreeBusy call from another user. Although its value is not limited by CDO, large numbers can result in a virtual memory failure.

The first month of free/busy information is always the current month. This can have an unexpected effect when the date is near the end of the month. For example, if "FreeBusyMonths" is set to 3 and the date is 29 April, GetFreeBusy returns information for April, May, and June, effectively only two months into the future.

The calendar rendering options that can be selected are as follows:

OptType string value

Data type

Corresponding ContainerRenderer property

Default value


Variant (vbDate format)


5:00 PM (17:00)


Variant (vbDate format)


9:00 AM (09:00)




Current calendar store or "Outlook"




7 (Sunday)












Current zone on Web server




62 (CdoMonday | | CdoFriday)

The session's options and the container renderer's properties are not automatically kept in synchronization. Changing an option does not cause the corresponding property to be changed, nor vice versa. Your application is responsible for setting all options and properties as appropriate.

Note that the "FirstDayOfWeek" option and the FirstDayOfWeek property are compatible with each other in using an enumeration starting with 1 for Monday and ending with 7 for Sunday, but they are not compatible with the DayOfWeekMask property of the RecurrencePattern object, which uses the mask constants CdoSunday through CdoSaturday. The "WorkingDays" option, however, is compatible with the mask constants.

© 2016 Microsoft