Hi John.
In automating Outlook from VFP, I can get the SenderName but nowhere can I find a way to access the sender's eMail address on a received mail item.The best I could come up with was to create an array called aContacts and loop through the the contact items in the contacts folder and save the following information:
This.aContacts[ lnContactCount, 1 ] = STRTRAN( .Email1DisplayName, '(E-mail)', '', -1, 1, 1 )
This.aContacts[ lnContactCount, 2 ] = STRTRAN( .Email2DisplayName, '(E-mail 2)', '', -1, 1, 1 )
This.aContacts[ lnContactCount, 3 ] = STRTRAN( .Email3DisplayName, '(E-mail 3)', '', -1, 1, 1 )
This.aContacts[ lnContactCount, 4 ] = .Email1Address
This.aContacts[ lnContactCount, 5 ] = .Email2Address
This.aContacts[ lnContactCount, 6 ] = .Email3Address
Then, when processing a message, I use code like this to get the sender's e-mail address:
IF '@' $ loItem.SenderName
m.lcSenderEm = loItem.SenderName
ELSE
lnRow = ASCAN( This.aContacts, loItem.SenderName, -1, -1, 1, 15 )
IF lnRow > 0
m.lcSenderEm = This.aContacts[ lnRow, 4 ]
ELSE
lnRow = ASCAN( This.aContacts, loItem.SenderName, -1, -1, 2, 15 )
IF lnRow > 0
m.lcSenderEm = This.aContacts[ lnRow, 5 ]
ELSE
lnRow = ASCAN( This.aContacts, loItem.SenderName, -1, -1, 3, 15 )
IF lnRow > 0
m.lcSenderEm = This.aContacts[ lnRow, 6 ]
ELSE
m.lcSenderEm = ''
ENDIF
ENDIF
ENDIF
ENDIF