Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook and VBA (http://www.outlookbanter.com/outlook-vba/)
-   -   trying to get recipient email address (http://www.outlookbanter.com/outlook-vba/59004-trying-get-recipient-email-address.html)

TMJNSK October 15th 07 08:48 PM

trying to get recipient email address
 
Hi All,

I have tried access sender's email and receiver's email. I have found
a code to get sender's email.I have used Redemption.safermailitem,
which works cool. But i have trouble in getting the receiver email
address.

I have tried the following items (sample code got it from internet)
Dim utils, MailItem, PrSMTPAddress, SMTPAddress
utils = CreateObject("Redemption.MAPIUtils")
PrSMTPAddress = &H39FE001E
'Get SMT P address of the first recipient. It is
assumed that the recipient is an Exchange Server user.
SMTPAddress =
utils.HrGetOneProp(oMailItem.Recipients(1).Address Entry.MAPIOBJECT,
PrSMTPAddress)
LogMessage("Receiver Address" + SMTPAddress)

But i am getting the following error at the place of HrGetOneProp -
System.Runtime.InteropServices.COMException (0xA5120009): Property is
read-only.
at Outlook.AddressEntry.set_MAPIOBJECT(Object MAPIOBJECT)
at
DIAMSXe_OutlookAddIn.XMailItem.btnAttachToDIAMSXe_ Click(CommandBarButton
ctrl, Boolean& cancel) at Outlook.AddressEntry.set_MAPIOBJECT(Object
MAPIOBJECT)
at
DIAMSXe_OutlookAddIn.XMailItem.btnAttachToDIAMSXe_ Click(CommandBarButton
ctrl, Boolean& cancel)Property is read-only.

For more information, see Help and Support Center at
http://go.microsoft.com/fwlink/events.asp.



Issue number 2:
Dim utils1, MailItem1, PrSenderEmailAddress,
SenderEMail
utils1 = CreateObject("Redemption.MAPIUtils")
PrSenderEmailAddress = &HC1F001E
SenderEMail =
utils1.HrGetOneProp(oMailItem.MAPIOBJECT, PrSenderEmailAddress)
LogMessage("Sender Address" + SenderEMail)

When i used this for sender's email, i was getting
"/O=COMPANYDOMAIN/OU=FIRST ADMINISTRATIVE GROUP/CN=RECIPIENTS/
CN=RECEIVERNAME.. "
Is this going to be the same for receiver email too?

Actually, i am looking for Email id. Can some one help me here.



All times are GMT +1. The time now is 05:30 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com