Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook and VBA (http://www.outlookbanter.com/outlook-vba/)
-   -   inconsistent in Redemption (http://www.outlookbanter.com/outlook-vba/12051-inconsistent-redemption.html)

Vadivel April 19th 06 09:33 AM

inconsistent in Redemption
 
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


Ken Slovak - [MVP - Outlook] April 19th 06 03:07 PM

inconsistent in Redemption
 
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



Dmitry Streblechenko April 19th 06 06:09 PM

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





Vadivel April 20th 06 08:15 AM

inconsistent in Redemption
 
Dmitry Streblechenko,

If my machine has only outlook installed and never used it for
downloading email.. Will the above code work still?

Thanks
Vadivel


Dmitry Streblechenko April 20th 06 06:15 PM

inconsistent in Redemption
 
I am not sure I completely understand - do you mean you are reading MSG
files on a machine that might not have a MAPI profile set up to connect to
the Exchange server that used to host the message now saved as an MSG file?.
PR_SMTP_ADDRESS may or may not be available in the message recipients table.
If it is available, then Recipient.Fields(PR_SMTP_ADDRESS) will retrieve it.
If it is not available, the only workaround is to read the value of
PR_ENTRYID and call IAddrBook::OpenEntry - that's what reading
Recipient.AddressEntry would do. But that requires a MAPI session connected
to an EX server that will be able to open the entry id in question.

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

"Vadivel" wrote in message
oups.com...
Dmitry Streblechenko,

If my machine has only outlook installed and never used it for
downloading email.. Will the above code work still?

Thanks
Vadivel




Vadivel April 21st 06 08:25 AM

inconsistent in Redemption
 
Dmitry Streblechenko,

My machine has only outlook installed and does not have mapi profile. I
trying to get the smtp addresses of the stored .msg files(i have stored
..msg file in the local hard disk.) I am using visual basic for that.
The above code is working for some email ids and it does not work for
some email ids. is there any way to solve this.

Thanks
Vadivel


Dmitry Streblechenko April 21st 06 06:44 PM

inconsistent in Redemption
 
Sorry, I am even more confused than before - how do you use Outlook if it
does not have at least one profile?
Where do the MSG files come from?

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

"Vadivel" wrote in message
oups.com...
Dmitry Streblechenko,

My machine has only outlook installed and does not have mapi profile. I
trying to get the smtp addresses of the stored .msg files(i have stored
.msg file in the local hard disk.) I am using visual basic for that.
The above code is working for some email ids and it does not work for
some email ids. is there any way to solve this.

Thanks
Vadivel




Vadivel April 24th 06 10:00 AM

inconsistent in Redemption
 
Hi,

I am storing the msg files manually.

Regards,
Vadivel


Dmitry Streblechenko April 24th 06 06:54 PM

inconsistent in Redemption
 
Do you mean by clicking "File | Save As" in Outlook? Or through some other
means?
Do you do that on the same machine? If yes, do you use the same MAPI profile
when saving and when restroring?

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

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

I am storing the msg files manually.

Regards,
Vadivel




Vadivel April 25th 06 08:11 AM

inconsistent in Redemption
 
Hi,

All the emails (.msg files) stored in the FileNet document management
respository and i am getting it from FileNet repository and storing it
to local drive and parse the email. Now i am trying to get the email
ids of email.. So am not using mapi profile. I have just installed
outlook 2002 in my machine..

Thanks
Vadivel



All times are GMT +1. The time now is 10:39 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