Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_cdo thread: Get the e-mail address from a CDO.Message object


Message #1 by "Dante Tang" <dan.tang@s...> on Fri, 19 Oct 2001 10:31:05
I'm trying to render a folder "Contacts" in my Exchange Server to a ASP 

page. I have got the Messages collection by the following statement.



  ' Session is Dim'ed and Set before



  Dim CdoMessages

  Dim CdoMessage

  

  Set CdoMessages = CdoSession.GetDefaultFolder

(CdoDefaultFolderContacts).Messages

  

  For Each CdoMessage In CdoMessages

  ' Print the DisplayName of the contact

    Response.Write(CdoMessage.Fields(&H3001001E).Value)

    Response.Write("<BR>")

    

  ' Print the E-mail address of the contact

    Response.Write(CdoMessage.Fields(-2121596897).Value)

  Next

  



Assume my company's domain name is sunny.com. The e-mail addresses can be 

displayed in SMTP format if they are not under the same domain name. 

However, for those contacts have e-mail addresses with the same domain 

name (sunny.com). (They are also existed in the Global Address List) The e-

mail address will be displayed in X.400 format.



Does anyone knows how to get the e-mail address of a CDO.Message object? 

Or is there any function can convert a X.400 e-mail address to SMTP format?



Thank you very much in advance.



Dante
Message #2 by "Siegfried Weber" <sweber@c...> on Fri, 19 Oct 2001 16:50:48 +0200
1. You're not using "CDO.Message" (as indicated in the subject), which

is CDO for Windows 2000 (CDOSYS)/CDO for Exchange 2000 (CDOEX); but

"MAPI.Session", which is CDO 1.21.



2. The MAPI property tag you use, "-2121596897", translates into hex

"&H818B001F" which indicated that it is a so-called "named property" and

will only work on this store (or even maybe folder). To learn what a

named property is and how to use the correct property check

http://www.cdolive.com/cdo10.htm



3. The issue you are facing is by design. Outlook always uses the

Exchange "DN" (Distinguish Name =3D the unique ID to identify the object

in the Exchange 5.5 Directory/Windows 2000 Active Directory). The only

way around is to get the corresponding AddressEntry out of the Global

Address List (GAL) and read the SMTP address (the latter one is

described on http://www.cdolive.com/cdo5.htm).



<Siegfried />



> -----Original Message-----

> From: Dante Tang [mailto:dan.tang@s...]

> Sent: Friday, October 19, 2001 12:31 PM

> To: ASP CDO

> Subject: [asp_cdo] Get the e-mail address from a CDO.Message object

>

> I'm trying to render a folder "Contacts" in my Exchange Server to a

ASP

> page. I have got the Messages collection by the following statement.

>

>   ' Session is Dim'ed and Set before

>

>   Dim CdoMessages

>   Dim CdoMessage

>

>   Set CdoMessages =3D CdoSession.GetDefaultFolder

> (CdoDefaultFolderContacts).Messages

>

>   For Each CdoMessage In CdoMessages

>   ' Print the DisplayName of the contact

>     Response.Write(CdoMessage.Fields(&H3001001E).Value)

>     Response.Write("<BR>")

>

>   ' Print the E-mail address of the contact

>     Response.Write(CdoMessage.Fields(-2121596897).Value)

>   Next

>

>

> Assume my company's domain name is sunny.com. The e-mail addresses can

be

> displayed in SMTP format if they are not under the same domain name.

> However, for those contacts have e-mail addresses with the same domain

> name (sunny.com). (They are also existed in the Global Address List)

The

> e-

> mail address will be displayed in X.400 format.

>

> Does anyone knows how to get the e-mail address of a CDO.Message

object?

> Or is there any function can convert a X.400 e-mail address to SMTP

> format?

>

> Thank you very much in advance.

>

> Dante

  Return to Index