View Single Post
  #3  
Old April 19th 06, 07:09 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default inconsistent in Redemption

PR_SMTP_ADDRESS is only available in the online mode. In the cached mode
(default in Outlook 2003) PR_SMTP_ADDRESS is ont available, so you need to
use PR_EMS_AB_PROXY_ADDRESSES instead (always available for the EX address
entries, see below).
Note that RDOAddressEntry object already exposes the SMTPAddress property.
Next version of Redemption will add that property to the
Redemption.AddressEntry object (returned by the Safe*Item objects).

PR_EMS_AB_PROXY_ADDRESSES = &H800F101E
If AddressEntry.Type = "EX" Then
ProxyAddresses = AddressEntry.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

"Ken Slovak - [MVP - Outlook]" wrote in message
...
Dmitry can correct me if I'm wrong but I'd sort of expect inconsistent
results from MAPIUtils unless its MAPIOBJECT property was assigned from
some session's MAPIOBJECT property.

Can you log into Outlook and get the NameSpace to get its MAPIOBJECT?
Perhaps you can use Redemption's RDOSession object to log into a MAPI
session and then use that session's MAPIOBJECT?

I'd also use MAPIUtils.Cleanup at the end of the code to release the
session and clean things up.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Vadivel" wrote in message
oups.com...
Hi,

I am trying to get the smtp address of the email item in outlook
offline(machine does not have outlook session). This is the my code.
But sometimes its giving the smtp address and sometimes it gives empty
stirng

Dim UtilObject As Redemption.MAPIUtils
Dim MessageItem As MessageItem
Dim ToAddress As SafeRecipient

Const PR_EMAIL = &H39FE001E

Set UtilObject = CreateObject("Redemption.MAPIUtils")

Set MessageItem = UtilObject.GetItemFromMsgFile("D:/test1.msg")

For Each ToAddress In MessageItem.Recipients

Debug.Print ToAddress.Address ' To get the smpt email id
If InStr(ToAddress.Address, "@") = 0 Then
Debug.Print ToAddress.Fields(PR_EMAIL) ' To get the smpt
email id
end if

Next

here ToAddress.Fields(PR_EMAIL) function sometiem gives proper smtp
address. but sometimes it gives empty string..

Any help really appreciated..

Thanks
Vadivel




Ads