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