Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming Add-Ins / November 2005

Tip: Looking for answers? Try searching our database.

Getting From Address in Sent Items with Exchange

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jim - 17 Nov 2005 20:42 GMT
I am trying to get the From Address from an email in the Sent Items
folder (i.e. I sent the email) while using Exchange.
Does anyone have any ideas?
I can get the from address if the email is in the inbox, but not if it
has been sent from outlook.
Thanks
Sue Mosher [MVP-Outlook] - 17 Nov 2005 21:09 GMT
In Outlook 2003, you can use the MailItem.SenderEmailAddress, but note that it's subject to security prompts.

In earlier versions, there is no Outlook property that returns the sender's email address. You can either use CDO (or Redemption to avoid security prompts -- http://www.dimastr.com/redemption/) to get the From address or use Outlook to get the Reply To address. Sample code at http://www.outlookcode.com/d/code/getsenderaddy.htm

To get the SMTP address from an Exchange sender or recipient, use CDO or Redemption and the PR_EMAIL (&H39FE001E) MAPI property to obtain the SMTP address from the AddressEntry object. See http://www.outlookcode.com/d/code/getsenderaddy.htm#redemption and http://www.cdolive.com/cdo5.htm#EMailAddressOfSender for examples.  

Signature

Sue Mosher, Outlook MVP
  Author of Configuring Microsoft Outlook 2003
    http://www.turtleflock.com/olconfig/index.htm
  and Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

>I am trying to get the From Address from an email in the Sent Items
> folder (i.e. I sent the email) while using Exchange.
> Does anyone have any ideas?
> I can get the from address if the email is in the inbox, but not if it
> has been sent from outlook.
> Thanks
Jim - 17 Nov 2005 21:43 GMT
Thanks Sue, using PR_EMAIL does not seem to work when trying to get the
from address with exchange and in the Sent Items folder. Have you ever
tried that?

> In Outlook 2003, you can use the MailItem.SenderEmailAddress, but note that it's subject to security prompts.
>
> In earlier versions, there is no Outlook property that returns the sender's email address. You can either use CDO (or Redemption to avoid security prompts -- http://www.dimastr.com/redemption/) to get the From address or use Outlook to get the Reply To address. Sample code at http://www.outlookcode.com/d/code/getsenderaddy.htm
>
> To get the SMTP address from an Exchange sender or recipient, use CDO or Redemption and the PR_EMAIL (&H39FE001E) MAPI property to obtain the SMTP address from the AddressEntry object. See http://www.outlookcode.com/d/code/getsenderaddy.htm#redemption and http://www.cdolive.com/cdo5.htm#EMailAddressOfSender for examples.  
Sue Mosher [MVP-Outlook] - 17 Nov 2005 23:10 GMT
Yes, it should work fine. Could you show a code snippet?

Signature

Sue Mosher, Outlook MVP
  Author of Configuring Microsoft Outlook 2003
    http://www.turtleflock.com/olconfig/index.htm
  and Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

> Thanks Sue, using PR_EMAIL does not seem to work when trying to get the
> from address with exchange and in the Sent Items folder. Have you ever
[quoted text clipped - 5 lines]
>>
>> To get the SMTP address from an Exchange sender or recipient, use CDO or Redemption and the PR_EMAIL (&H39FE001E) MAPI property to obtain the SMTP address from the AddressEntry object. See http://www.outlookcode.com/d/code/getsenderaddy.htm#redemption and http://www.cdolive.com/cdo5.htm#EMailAddressOfSender for examples.  
Jim - 18 Nov 2005 00:42 GMT
Sure thanks Sue,

int PR_EMAIL = 972947486;
object email = safeMailItem.Sender.get_Fields(PR_EMAIL);

email will be null here if looking at an email that I sent using
exchange, but it will work fine to get the Sender address for an email I
received.

Thanks

> Yes, it should work fine. Could you show a code snippet?
Jim - 18 Nov 2005 19:12 GMT
Thanks Sue for your continued help. Do you have any ideas on this ?
Thanks

> Sure thanks Sue,
>
[quoted text clipped - 8 lines]
>
>> Yes, it should work fine. Could you show a code snippet?
Dmitry Streblechenko - 18 Nov 2005 21:28 GMT
PR_SMTP_ADDRESS is not available in the cached mode, but multivalueed
PR_EMS_AB_PROXY_ADDRESSES is:

PR_EMS_AB_PROXY_ADDRESSES = &H800F101E

If safeMailItem.Sender.Type = "EX" Then

 ProxyAddresses = safeMailItem.Sender.Fields(PR_EMS_AB_PROXY_ADDRESSES)

 for i = LBound(ProxyAddresses) to UBound(ProxyAddresses)

   if Left(ProxyAddresses(i), 5) = "SMTP:" Then

     strAddress = Right(ProxyAddresses(i), Len(ProxyAddresses(i))-5)

     Exit for

   End If

 Next

End If

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

> Sure thanks Sue,
>
[quoted text clipped - 7 lines]
>
>> Yes, it should work fine. Could you show a code snippet?
Jim - 18 Nov 2005 22:07 GMT
Thank you Dmitry for your continued help on this.
I have tried this. I am using C# so it is a little different.
int PR_EMS_AB_PROXY_ADDRESSES = -2148470814;
object proxy  = safeMailItem.Sender.get_Fields(PR_EMS_AB_PROXY_ADDRESSES);

proxy here is null.

Any ideas?
Thank you

> PR_SMTP_ADDRESS is not available in the cached mode, but multivalueed
> PR_EMS_AB_PROXY_ADDRESSES is:
[quoted text clipped - 35 lines]
>>
>>>Yes, it should work fine. Could you show a code snippet?
Dmitry Streblechenko - 19 Nov 2005 06:37 GMT
The tag is wrong. If you want to define it as a signed int, 0x800F101E
is -2146496482.

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

> Thank you Dmitry for your continued help on this.
> I have tried this. I am using C# so it is a little different.
[quoted text clipped - 46 lines]
>>>
>>>>Yes, it should work fine. Could you show a code snippet?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.