The DataSource property contains the CDO container object to be rendered. Read/write.
objContRend.DataSource
Object (AddressEntries collection, Folders collection, Messages collection, or Recipients collection)
The DataSource property accepts a CDO AddressEntries, Folders, Messages, or Recipients collection.
Setting the DataSource property specifies the container object to be rendered and instantiates a new Views collection for the container renderer. Any previous folder views are released and replaced from the new Views collection. All common and personal views remain in effect, and any existing custom views are also retained.
If you are rendering an address book container, you must define one or more custom views for it, because it has no predefined common, personal, or folder views. Furthermore, you must Add any new custom views to the present Views collection before you set DataSource to an AddressEntries collection. Otherwise the new custom views are not handled properly in the rendering.
Setting the DataSource property repopulates the collection underlying the container object and revises its filter, just as setting the container renderer's CurrentView property does. Any previous settings of the filter are ignored.
If you are preparing to render a folder and set DataSource to a Folders or Messages collection, the CurrentView property is automatically reset to the new Views collection's default current view. If you are not rendering a folder, DataSource and CurrentView operate independently, so when you set DataSource to an object other than a Folders or Messages collection, CurrentView is left unchanged.
For more information, see Rendering Container Objects.
This code fragment assigns the DataSource property to the Messages collection of the Session object's Inbox folder:
' assume valid ContainerRenderer and Session objects
Set objInbox = objSession.Inbox
objContRend.DataSource = objInbox.Messages