find sender info

  • Thread starter Thread starter Edward
  • Start date Start date
E

Edward

Hi everybody,
I know how to get sender's name programatically but I don't know how to get
additional infor like (Office,department) , We use outlook 2003 and exchange
server each person has those additional inofmration in his/her global address
list
 
If you are using the Outlook Obejct Model, you best bet is probably to take
the value of the MailItem.SenderEmailAddress property and use it to call
Namespace.CreateRecipient, followed by Recipient.Resolve. You should then be
able to access the Recipeint.AddressEntry objeect.
Strictly speaking, no name/address/etc resolution is necessary since the
message already contains the sender entry id (PR_SENDER_ENTRYID MAPI
property), but OOM does not expose it.
<plug> Redemption woudl let you directly access the sender properties
through the RDOMail.Sender property </plug>

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 
Thanks
I got up to this point

Dim myolApp As Outlook.Application
Dim myNamespace As Outlook.NameSpace
Dim myRecipient As Outlook.Recipient
Set myolApp = CreateObject("Outlook.Application")
Set myNamespace = myolApp.GetNamespace("MAPI")
Set myRecipient = myNamespace.CreateRecipient(msg.SenderEmailAddress)
'myRecipient.Resolve
myRecipient.AddressEntry

But I can't find the office location based on AddressEntry, Office location
is in contacts and I'm not sure how to continue this code ?
Any siggestions?

--
Best regards,
Edward


Dmitry Streblechenko said:
If you are using the Outlook Obejct Model, you best bet is probably to take
the value of the MailItem.SenderEmailAddress property and use it to call
Namespace.CreateRecipient, followed by Recipient.Resolve. You should then be
able to access the Recipeint.AddressEntry objeect.
Strictly speaking, no name/address/etc resolution is necessary since the
message already contains the sender entry id (PR_SENDER_ENTRYID MAPI
property), but OOM does not expose it.
<plug> Redemption woudl let you directly access the sender properties
through the RDOMail.Sender property </plug>

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 
What version of Outlook are you using?

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
Edward said:
Thanks
I got up to this point

Dim myolApp As Outlook.Application
Dim myNamespace As Outlook.NameSpace
Dim myRecipient As Outlook.Recipient
Set myolApp = CreateObject("Outlook.Application")
Set myNamespace = myolApp.GetNamespace("MAPI")
Set myRecipient = myNamespace.CreateRecipient(msg.SenderEmailAddress)
'myRecipient.Resolve
myRecipient.AddressEntry

But I can't find the office location based on AddressEntry, Office
location
is in contacts and I'm not sure how to continue this code ?
Any siggestions?
 
If you are using Outlook 2007, you can use PropertyAccessor to read the
PR_SENT_REPRESENTING_ENTRYID property
(http://schemas.microsoft.com/mapi/proptag/0x00410102). You can then use its
value to call Namespace.GetAddressEntryFromId.
Once you have AddressEntryObject, you can call AddressEntry.GetExchangeUser
to get the ExchangeUser object.
Or use AddressEntry.PropertyAccessor to read any raw MAPI properties
directly.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 
Back
Top