Getting SMTP address but incorrect value

V

vincent.y.chan

Hi,

I was wondering if anyone could help me out. I have an outlook 2003
addin and it requires me to get the user's email address. To get that
value, I used "addressEntry.Fields(&H39FE001E)" to retrieve it but
here is the problem. For certain clients, I'm getting strange
values. I have provided an example below. The FromName value equals
to the user name and the fromemailaddress value is the user's email
address that i'm trying to get


FromName: John Doe. (617) FromEmailAddress: 617

FromName: Bob Smith FromEmailAddress: Bob Smith

Here's what I'm looking for:

FromName: John Smith FromEmailAddress: (e-mail address removed)

Any help would be appreciated. Unfortunately, I'm not sure why when I
use "addressEntry.Fields(&H39FE001E)", I'm getting values other than
the email address.

thanks,

Vincent
 
K

Ken Slovak - [MVP - Outlook]

Does this happen with cached mode in Outlook against Exchange? You might
have to fall back to using PR_EMS_AB_PROXY_ADDRESSES (0x800F101E), which
returns an array of addresses. The default SMTP address would be prefixed by
"SMTP:".
 
V

vincent.y.chan

Hi Ken,

Thanks for getting back to me. I checked the settings and it appears
that Outlook is in cached mode. Could there be another reason? I
just find it strange because it's not happening to all of my clients.

thanks,

Vince

Does this happen with cached mode in Outlook against Exchange? You might
have to fall back to using PR_EMS_AB_PROXY_ADDRESSES (0x800F101E), which
returns an array of addresses. The default SMTP address would be prefixed by
"SMTP:".

--
Ken Slovak
[MVP - Outlook]http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Optionshttp://www.slovaktech.com/products.htm


I was wondering if anyone could help me out. I have an outlook 2003
addin and it requires me to get the user's email address. To get that
value, I used "addressEntry.Fields(&H39FE001E)" to retrieve it but
here is the problem. For certain clients, I'm getting strange
values. I have provided an example below. The FromName value equals
to the user name and the fromemailaddress value is the user's email
address that i'm trying to get
FromName: John Doe. (617) FromEmailAddress: 617
FromName: Bob Smith FromEmailAddress: Bob Smith
Here's what I'm looking for:
FromName: John Smith FromEmailAddress: (e-mail address removed)
Any help would be appreciated. Unfortunately, I'm not sure why when I
use "addressEntry.Fields(&H39FE001E)", I'm getting values other than
the email address.

Vincent
 
V

vincent.y.chan

Hi Ken,

I actually double checked my code and here is what I have..

Select Case addressEntry.Type
Case "SMTP"
result.Add(addressEntry.Address)
Case "EX"

result.Add(DirectCast(addressEntry.Fields(&H39FE001E), String))
etc..


If the addressEntry.type is SMTP, can I assume that
addressEntry.address will get me the user's email address? I guess
I'm wondering if maybe I haven't look at a situation where I should
have..

Your help is much appreciated,

Vince


Does this happen with cached mode in Outlook against Exchange? You might
have to fall back to using PR_EMS_AB_PROXY_ADDRESSES (0x800F101E), which
returns an array of addresses. The default SMTP address would be prefixed by
"SMTP:".

--
Ken Slovak
[MVP - Outlook]http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Optionshttp://www.slovaktech.com/products.htm


I was wondering if anyone could help me out. I have an outlook 2003
addin and it requires me to get the user's email address. To get that
value, I used "addressEntry.Fields(&H39FE001E)" to retrieve it but
here is the problem. For certain clients, I'm getting strange
values. I have provided an example below. The FromName value equals
to the user name and the fromemailaddress value is the user's email
address that i'm trying to get
FromName: John Doe. (617) FromEmailAddress: 617
FromName: Bob Smith FromEmailAddress: Bob Smith
Here's what I'm looking for:
FromName: John Smith FromEmailAddress: (e-mail address removed)
Any help would be appreciated. Unfortunately, I'm not sure why when I
use "addressEntry.Fields(&H39FE001E)", I'm getting values other than
the email address.

Vincent
 
K

Ken Slovak - [MVP - Outlook]

Yes, if the address type is SMTP then you can just use addressEntry.Address.

Otherwise you'd need to try both of the properties depending on the Exchange
connection type. You can check that by looking at the
NameSpace.ExchangeConnectionType property, which returns an
OlExchangeConnectionMode enum member based on the connection type.
 
V

vincent.y.chan

Hi Ken,

I just talked to my client and he said he uses POP on the microsoft
exchange server. He has several accounts in his outlook POP that
includes at least one private email address as well. Would this cause
a problem for me if I used addressEntry.Fields(&H39FE001E)? Would it
be wise to use PR_EMS_AB_PROXY_ADDRESSES (0x800F101E) instead?

thanks,

Vincent




Does this happen with cached mode in Outlook against Exchange? You might
have to fall back to using PR_EMS_AB_PROXY_ADDRESSES (0x800F101E), which
returns an array of addresses. The default SMTP address would be prefixed by
"SMTP:".

--
Ken Slovak
[MVP - Outlook]http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Optionshttp://www.slovaktech.com/products.htm


I was wondering if anyone could help me out. I have an outlook 2003
addin and it requires me to get the user's email address. To get that
value, I used "addressEntry.Fields(&H39FE001E)" to retrieve it but
here is the problem. For certain clients, I'm getting strange
values. I have provided an example below. The FromName value equals
to the user name and the fromemailaddress value is the user's email
address that i'm trying to get
FromName: John Doe. (617) FromEmailAddress: 617
FromName: Bob Smith FromEmailAddress: Bob Smith
Here's what I'm looking for:
FromName: John Smith FromEmailAddress: (e-mail address removed)
Any help would be appreciated. Unfortunately, I'm not sure why when I
use "addressEntry.Fields(&H39FE001E)", I'm getting values other than
the email address.

Vincent
 
K

Ken Slovak - [MVP - Outlook]

I don't know what POP on an Exchange server means.

As I said, you check the connection mode and take action based on that. If
it's an Exchange profile then you have to be prepared to work with either
property depending on the results you get back. If it's just an SMTP address
you use addressEntry.Address. If non-cached mode is being used then
PR_EMAIL_ADDRESS is what you use. You might also want to check
PR_EMAIL_ADDRESS_W (&H39FE001F) in addition to PR_EMAIL_ADDRESS
(&H39FE001E).
 
V

vincent.y.chan

Hi Ken,

Thanks for getting back to me so quickly. I just wanted to make
sure... if I know the type is "EX"... would I then use the
NameSpace.ExchangeConnectionType property to see if it's in cached
mode or not?

thanks,

Vincent

I don't know what POP on an Exchange server means.

As I said, you check the connection mode and take action based on that. If
it's an Exchange profile then you have to be prepared to work with either
property depending on the results you get back. If it's just an SMTP address
you use addressEntry.Address. If non-cached mode is being used then
PR_EMAIL_ADDRESS is what you use. You might also want to check
PR_EMAIL_ADDRESS_W (&H39FE001F) in addition to PR_EMAIL_ADDRESS
(&H39FE001E).

--
Ken Slovak
[MVP - Outlook]http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Optionshttp://www.slovaktech.com/products.htm


I just talked to my client and he said he uses POP on the microsoft
exchange server. He has several accounts in his outlook POP that
includes at least one private email address as well. Would this cause
a problem for me if I used addressEntry.Fields(&H39FE001E)? Would it
be wise to use PR_EMS_AB_PROXY_ADDRESSES (0x800F101E) instead?

Vincent
 
V

vincent.y.chan

Hi Ken

is it possible to use PR_EMAIL_ADDRESS in a cached mode situation with
outlook 2003? Would it just break if I used it? or would it return a
value?

I have incorporated the code you suggested above, however, I cannot
reproduce the problem I'm having with one of my clients. We both have
the same code and we are both using PR_EMAIL_ADDRESS. However, from
the log files I have... I can see that my client is returning a value
of 'john smith' and not the email address, however, in my case, i'm
returning my email address and we are both in cached mode.

much appreciated,

Vince



Yes, exactly.

--
Ken Slovak
[MVP - Outlook]http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Optionshttp://www.slovaktech.com/products.htm


Thanks for getting back to me so quickly. I just wanted to make
sure... if I know the type is "EX"... would I then use the
NameSpace.ExchangeConnectionType property to see if it's in cached
mode or not?

Vincent
 
K

Ken Slovak - [MVP - Outlook]

Whether or not PR_EMAIL_ADDRESS returns a value depends not only on cached
mode against Exchange but also which address list the address entry lives
in. At worst using that property would return an Empty value, which could be
checked (If IsEmpty(addressEntry.Fields(&H39FE001E))). Same thing for
PR_EMS_AB_PROXY_ADDRESSES.

I would code things to first look at addressEntry.Address, then if that's an
Exchange DN to look at PR_EMAIL_ADDRESS and if that failed then look at
PR_EMS_AB_PROXY_ADDRESSES.

We haven't discussed how you're getting to use addressEntry.Fields, is it
with CDO 1.21 or Redemption or some other way? If you are using Redemption
you can bypass the Fields collection completely and just use
rdoAddressEntry.SMTPAddress, which will return an SMTP address no matter
what the configuration.
 
V

vincent.y.chan

Hi Ken,

I'm using redemption version 3.3. I know the smtpaddress property is
available on version 4.2 but if possible, I would like to stick with
version 3.3 for now since many of my clients are on that version.

With this check that you suggested "(If
IsEmpty(addressEntry.Fields(&H39FE001E)))".. is it possible that this
value is not an email address? I'll put in an extra check just in
case anyways.

thanks again

Vince




Whether or not PR_EMAIL_ADDRESS returns a value depends not only on cached
mode against Exchange but also which address list the address entry lives
in. At worst using that property would return an Empty value, which could be
checked (If IsEmpty(addressEntry.Fields(&H39FE001E))). Same thing for
PR_EMS_AB_PROXY_ADDRESSES.

I would code things to first look at addressEntry.Address, then if that's an
Exchange DN to look at PR_EMAIL_ADDRESS and if that failed then look at
PR_EMS_AB_PROXY_ADDRESSES.

We haven't discussed how you're getting to use addressEntry.Fields, is it
with CDO 1.21 or Redemption or some other way? If you are using Redemption
you can bypass the Fields collection completely and just use
rdoAddressEntry.SMTPAddress, which will return anSMTPaddress no matter
what the configuration.

--
Ken Slovak
[MVP - Outlook]http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Optionshttp://www.slovaktech.com/products.htm


is it possible to use PR_EMAIL_ADDRESS in a cached mode situation with
outlook 2003? Would it just break if I used it? or would it return a
value?
I have incorporated the code you suggested above, however, I cannot
reproduce the problem I'm having with one of my clients. We both have
the same code and we are both using PR_EMAIL_ADDRESS. However, from
the log files I have... I can see that my client is returning a value
of 'john smith' and not the email address, however, in my case, i'm
returning my email address and we are both in cached mode.
much appreciated,
 
K

Ken Slovak - [MVP - Outlook]

Any data that you get back from that property should be the email address,
yes.

I'm currently using Redemption version 4.5 myself. Lots of bug fixes in
addition to new features since 3.3.
 
V

vincent.y.chan

Hi Ken,

I got some extra logging information back from my client and I was
wondering if you have seen this before.

Somewhere along my code this line is called.. Dim addressEntry As
Redemption.AddressEntry = CType(safeCurrentUser,
Redemption.AddressEntry).

I found out that the value of addressEntry.type is "voicemail" and not
"STMP" or "EX". Have you seen this before? The client has multiple
email accounts on their outlook and I believe one of them is a voice
over ip telephony account which uses MAPI. Could this be the reason
why I'm getting the "voicemail" value for addressEntry?

I searched all over the web and doesn't seem like anyone else has
encountered this before nor have I seen any situation where the
addressEntry type value would be voicemail.

Your insight or help would be greatly appreciated,

Vincent





Any data that you get back from that property should be the email address,
yes.

I'm currently using Redemption version 4.5 myself. Lots of bug fixes in
addition to new features since 3.3.

--
Ken Slovak
[MVP - Outlook]http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Optionshttp://www.slovaktech.com/products.htm


I'm using redemption version 3.3. I know the smtpaddress property is
available on version 4.2 but if possible, I would like to stick with
version 3.3 for now since many of my clients are on that version.
With this check that you suggested "(If
IsEmpty(addressEntry.Fields(&H39FE001E)))".. is it possible that this
value is not an email address? I'll put in an extra check just in
case anyways.
thanks again
 
K

Ken Slovak - [MVP - Outlook]

AddressEntry.Type is a string value that can be any arbitrary string. A
custom provider can use a string such as "voicemail" certainly. I haven't
run into that myself but you have to be prepared for the unexpected anyway.
Just check for "SMTP" or "EX" or other types you are prepared to handle and
bypass or use special handling for other types.

You are aware that you can also run into "FAX" as a type also, aren't you?
Outlook considers fax numbers to be valid electronic addresses and you can
certainly run into an AddressEntry object where type is "FAX", so you also
have to be prepared for that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top