Parent Property (All CDO Library Objects)
Parent Property (All CDO Library Objects)
The Parent property returns the parent of the object. Read-only.
Syntax
Set objParent = object.Parent
Data Type
Object
Remarks
The Parent property in CDO returns the immediate parent of an object. The immediate parent for each object is shown in the following table.
CDO Library object |
Immediate parent in object hierarchy |
AddressEntries collection |
|
AddressEntry (returned by Session.CurrentUser) |
AddressEntries collection |
AddressEntry (all others) |
|
AddressEntries collection |
|
AddressLists collection |
|
AddressLists collection |
|
Messages collection |
|
Attachments collection |
|
Attachments collection |
|
Fields collection |
|
Fields collection |
AddressEntry, AddressEntryFilter, AddressList, AppointmentItem, Attachment, Folder, InfoStore, Message, or MessageFilter |
Folder (Inbox or Outbox) |
|
Folder (all others) |
|
Folders collection |
Folder, including Inbox or Outbox |
Messages collection |
|
InfoStores collection |
|
InfoStores collection |
|
Messages collection |
|
Messages collection |
|
Messages collection |
|
Messages collection |
Folder, including Inbox or Outbox |
Recipients collection |
|
Recipients collection |
|
Set to Nothing |
The Parent property represents the immediate parent of the object, rather than the logical parent. For example, a folder contains a Messages collection, which contains Message objects. The Parent property for a message is the immediate parent, the Messages collection, rather than the logical parent, the Folder object.
The Session object represents the highest level in the hierarchy of CDO Library objects and its Parent property is set to Nothing.
For more information on the CDO Library object hierarchy, see Object Model.
The Parent property does not correspond to a MAPI property and cannot be rendered into HTML hypertext by the CDO Rendering Library. Depending on the parent object returned, you might be able to render it as an object, by setting the ObjectRenderer object's DataSource property to the object returned by the Parent property, or as a container object, by setting the ContainerRenderer object's DataSource property to the collection object returned by the Parent property. See the DataSource properties for what objects are accepted.
Example
This code fragment displays the Class of the parent Messages collection of a Message object:
' Function: Message_Parent
Function Message_Parent()
' error handling here ...
If objOneMsg Is Nothing Then
MsgBox "Need to select a message; see Messages->Get*"
Exit Function
End If
' Immediate parent of message is the Messages collection
MsgBox "Message immediate parent class = " & objOneMsg.Parent.Class
' error handling code ...
End Function
To get to the Folder object, you have to take the parent of the Messages collection:
' Function: Messages_Parent
' Purpose: Display the Messages collection Parent class value
' See documentation topic: Parent property
Function Messages_Parent()
Set objMessages = objOneMsg.Parent
' error handling here ...
If objMessages Is Nothing Then
MsgBox "No Messages collection available"
Exit Function
End If
MsgBox "Messages collection parent class = " & objMessages.Parent.Class
Exit Function
' error handling here ...
End Function