Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SenderName property of MailItem does not return email address

0 views
Skip to first unread message

dsbsystems

unread,
May 30, 2001, 5:53:44 PM5/30/01
to
How can I get this information? It must be embedded in the mail somewhere,
'cos I can reply to a message

I cannot find any Microsoft documentation about this


Neo

unread,
May 31, 2001, 8:44:33 AM5/31/01
to
The Outlook Object Model doesn't expose the sender's email address directly.
Instead, you have to use 1 of 2 techniques to get it.

1) Issue a reply on the message and review the recipients collection to get
at the email address.

2) Use Collaboration Data Objects 1.21 to get at the information

Function SenderFromAddress(objMsg As MailItem) As String
Dim strEntryID As String
Dim strStoreID As String
Dim objSession As MAPI.Session
Dim objCDOItem As MAPI.Message

' get EntryID and StoreID for message
strEntryID = objMsg.EntryID
strStoreID = objMsg.Parent.StoreID

' start CDO session
Set objSession = CreateObject("MAPI.Session")
objSession.Logon , , False, False

' pass item to CDO and get sender address
On Error Resume Next
Set objCDOItem = objSession.GetMessage(strEntryID, strStoreID)
SenderFromAddress = objCDOItem.Sender.Address

Set objSession = Nothing
Set objCDOItem = Nothing
End Function


--
/Neo


"dsbsystems" <dsbsy...@aladdinscave.net> wrote in message
news:3b156...@news2.vip.uk.com...

0 new messages