Link to home
Start Free TrialLog in
Avatar of sdai
sdai

asked on

How to get recipient's email address without CDO?

I am trying to get the the recipient's email address of a appointment Item.
From the recipient.address, I can only get exchange version of address, not a SMTP, like user@hotmail.com.

I can't use CDO either since it doesn't come with the default outlook installation and I am not allowed to include it with my software.

Any suggestion is appreciated.

Steven
Avatar of jessnjeff
jessnjeff

Just a guess, but instead of the recipient, what value does the To field have?
Avatar of sdai

ASKER

Item.RequiredAttendees is there but just a text.
I have a item.to field on my appointment item.
Avatar of sdai

ASKER

Mine says doesn't support this method or property. I check the type library, it's not there.
Duh(she says, feeling stupid)

Okay--let me get the basic background

What is your interface?  OUtlook, VB, VBA, what?
Avatar of sdai

ASKER

Outlook, inside the form's script engine using VBScript.
I can only get the SMTP value from an address not in your GAL.  I twisted Outlook everyway I could (even went to VBA), but could only get the 'real' address if it was outside our Ex. server.

I am going to keep trying though.
Avatar of sdai

ASKER

Thanks.

Actually I want the 'real' email address. The problem is with the address from GAL. It doesn't give me a 'real' address. It gives a X.400 type address. I.e., it gives the coporation full name(My Company Inc.) and a user id like sdai. I somehow have to get 'sdai@MyCompany.com'.
We have a standard here in creating email addresses.  Can you work with the name string to get your address?

Code snippet using my name.  We use 1st initial & Last Name


recipient.name = "Hendrix, Jesslyn"

Dim curuser As String
Dim uName As String
curuser = oMapi.CurrentUser

    a = InStrRev(curuser, ",")
    b = Left(curuser, a - 1)
    d = Len("hendrix, jesslyn")
    c = Mid(curuser, a + 2, 1)

uName = c & b & "@mycompany.com"
Or you can use the username.  

Dim oNet
Set oNet = WScript.CreateObject("WScript.Network")
strUSERNAME = UCase(oNet.UserName)
Avatar of sdai

ASKER

The first problem is with the duplicate names.
The other problem is that I want @mycompany(my main problem). I don't know how to get it from "My Company Inc" working for all situations.

Thanks.
I don't understand about 'duplicate names'

Also, please elaborate on that and what you mean about the @.  If only the internal addresses are shown as X400 addresses, then you should be able to either grab the recipient.name(not recipient.address) and concatenate with your @text?
Avatar of sdai

ASKER

For example, Bill Gates and Barbara Gates will have the same email as bGates.

The Second problem is that I only have "Microsoft Corp" as company name from GAL entry. I want 'microsoft' as my email name. I.e., I want the current company's email alias. I use the full email address for other purposes.
Sorry, that code was just a demonstration of getting your info using a standard and the recipient.name (vs the address).

As far as the alias, wouldn't that be the same 'firmwide'?  Meaning, it could be hardcoded.
Avatar of sdai

ASKER

I guess that I really want is the IP address? Is it? Like microsoft.com is the an IP address.

What do you think?
I don't have the code to do this.  Try www.freevbcode.com
Sorry we just went round & round (although I do like to dance!)
Avatar of sdai

ASKER

Thanks a lot.
I will check out the site and let you know the result.
ASKER CERTIFIED SOLUTION
Avatar of jessnjeff
jessnjeff

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sdai

ASKER

Thanks.

I got something from MSDN like

 Set Info = CreateObject("AdSystemInfo")
 GetDomainName = Info.DomainDNSName

where GetDomainName returns something like 'corp.microsoft.com'.

I think that's what I want. Th only concern is that AdSystemInfo(Active Directory) only exists on Win2000 and we need to support WinMe.

The other thing I'd like to confirm with you is that whether CDO is installed by default and whether it exist on WinMe. I happened to uninstall and reinstall both Outlook 2002 and 2000 on Win2000 and WinMe separately. On both cases, I didn't have CDO on either one.
Hello sdai

this question is open for more then 2 months
time to clean up
if not stated otherwise

my recommendation will be
-PAQ and refund
-this will be finalized by an EE Moderator
-with no further update (23.11.2002)

PLEASE DO NOT ACCEPT THIS COMMENT AS ANSWER

HAGD:O)Bruintje
posted by ToolzEE v1.0
Avatar of sdai

ASKER

Hi, jessnieff,

I was reminded to cleanup my questions and noticed that this one has been forgot for a while.

My project is almost complete and thank you very much for all your help,


Steven