Views Collection Object

The Views collection object contains one or more views for a container object.

At a Glance

Specified in type library: CDOHTML.DLL
First available in: CDO Rendering Library version 1.1
Parent objects: ContainerRenderer
Child objects: CalendarView
TableView
Default property: Item

An Views collection supports count and index values that let you access an individual TableView object through the Item property. The Views collection also supports the Microsoft® Visual Basic® For Each statement.

Properties


Name
Available since version
Type

Access
Class 1.1 Long Read-only
Count 1.1 Long Read-only
Item 1.1 TableView object Read-only
Parent 1.1 ContainerRenderer object Read-only

Methods


Name
Available since version
Parameters
Add 1.1 bstrName as String,
(optional) varClass as Long,
(optional) varSortBy as Variant,
(optional) varSortAscending as Boolean

Remarks

The Views collection can contain a variety of different classes of view objects. The classes currently implemented are represented by the CalendarView and TableView objects.

The Views collection is used by a ContainerRenderer object to render a container object, such as an address book container or a folder. The Views collection comes into being when a rendering application sets the container renderer's DataSource property to the container object. The collection is released when the parent ContainerRenderer object is released, or when a new container object is set in the DataSource property.

The classes of views that can be held in a Views collection and rendered by a ContainerRenderer object are as follows:

View class View source container object
CalendarView Messages collection containing AppointmentItem objects
TableView AddressEntries collection, Folders collection, Messages collection, or Recipients collection

The various view objects initially in the collection are those that were already generated externally to the rendering application. These views persist in the underlying store, typically a directory or message store. New views can be defined and contributed to the collection using the Add method, but they do not persist after the collection is released.

The view to be applied to the container object is specified in the container renderer's CurrentView property. A newly instantiated Views collection always has a default current view. This default can be specified by the store underlying the container object. If it is not specified, the CDO Rendering Library sets it to the first view in the collection.

Changing the current view causes a new AddressEntries, Folders, Messages, or Recipients collection to be instantiated. This collection contains only the items that pass the restriction specified by the new view. The AddressEntry, Folder, Message, or Recipient objects in the collection are sorted as specified by the view. If a folder view is categorized, GroupHeader objects appear in the collection along with the messages.

The initial filter on the AddressEntries, Folders, Messages, or Recipients collection is inherited from the view's restriction. It can be used without modification, but it cannot be read or changed by the rendering application. Any attempt to read a property on an inherited AddressEntryFilter or MessageFilter object results in an error return. Writing any property on an inherited filter disinherits it and refreshes the collection. This means that the collection is reinstantiated with a new filter specifying only the property just written. This new filter, however, is no longer inherited, and the application can read its properties and set additional restrictions within it.