Share via


Parent Property

Parent Property

The Parent property returns a reference to the parent BodyPart object.

Syntax

Property Parent as IBodyPartHRESULT get_Parent(IBodyPart** pVal);

Remarks

Message content that is other than plain US-ASCII is arranged in a parent-child hierarchy. You can use the Parent property to navigate up from the current object to the object one level higher. If the object has no parent, as is the case with the Message object, an exception is raised.

As noted earlier, the Parent object may be an instance of the BodyPart COM class.

Example

Dim iMsg as New CDO.Message
Dim iBp1 as CDO.IBodyPart
Dim iBp2 as CDO.IBodyPart

Set iBp1 = iMsg.AddAttachment "c:\\files\\file.doc"
Set iBp2 = iBp1.Parent
' we now have the IBodyPart interface on the Message object, as it
' is the parent of the attachment BodyPart object.