Sender Property (Message Object)

The Sender property returns or sets the sender of a message as an AddressEntry object. Read/write.

Syntax

Set objAddrEntry = objMessage.Sender

objAddrEntry
Object. The returned AddressEntry object that represents the messaging user that sent the message.
objMessage
Object. The Message object.

Data Type

Object (AddressEntry)

Remarks

You can change the Sender property before a message is either sent or saved, for example in a public folder. After a message has been sent or saved, any attempt to change its Sender property is ignored.

The current version of CDO does not support the Sender property on AppointmentItem objects. An attempted access returns CdoE_NOT_FOUND.

The Sender property does not correspond to a MAPI property and cannot be rendered into HTML hypertext by the CDO Rendering Library. It could be rendered as an object by setting the ObjectRenderer object's DataSource property to the AddressEntry object returned by the Sender property.

The Name property of the AddressEntry object returned by the Sender property corresponds to the MAPI property PR_SENT_REPRESENTING_NAME. To render just the sender's name, you can set the object renderer's DataSource property to this AddressEntry object and the property parameter of the RenderProperty method to CdoPR_SENT_REPRESENTING_NAME.

Example

This code fragment displays the name of the sender of a message:

' from the sample function Message_Sender 
Set objAddrEntry = objOneMsg.Sender 
If objAddrEntry Is Nothing Then 
    MsgBox "Could not set the AddressEntry object from the Sender" 
    Exit Function 
End If 
MsgBox "Message was sent by " & objAddrEntry.Name