A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Finding an email address based on a name



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old November 13th 09, 09:39 PM posted to microsoft.public.outlook.program_vba
cherman
external usenet poster
 
Posts: 4
Default Finding an email address based on a name

Hi there. I am working in Access 2003 with a reference to Outlook 2003. Is
there a way in VBA to find an email address based on a name? Maybe something
like using the Select Names dialog when you click the To... button on an
email message?

I can obviously do this manually by typing in the name and showing results
from the Global Address List, but I could have hundreds to do and I would
love to populate a table automatically behind the scenes.

Thanks in advance,
Clint
Ads
  #2  
Old November 13th 09, 09:51 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Finding an email address based on a name

Use Namespace.CreateRecipient, followed by Recipient.Resolve

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"cherman" wrote in message
...
Hi there. I am working in Access 2003 with a reference to Outlook 2003. Is
there a way in VBA to find an email address based on a name? Maybe
something
like using the Select Names dialog when you click the To... button on an
email message?

I can obviously do this manually by typing in the name and showing results
from the Global Address List, but I could have hundreds to do and I would
love to populate a table automatically behind the scenes.

Thanks in advance,
Clint



  #3  
Old November 16th 09, 03:23 PM posted to microsoft.public.outlook.program_vba
cherman
external usenet poster
 
Posts: 4
Default Finding an email address based on a name

Thank you. I can get the code to work with my existing code and get the test
to pan out (that the recipient is in the address book), but how do I capture
the actual email address?

Thanks again!
Clint


"Dmitry Streblechenko" wrote:

Use Namespace.CreateRecipient, followed by Recipient.Resolve

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"cherman" wrote in message
...
Hi there. I am working in Access 2003 with a reference to Outlook 2003. Is
there a way in VBA to find an email address based on a name? Maybe
something
like using the Select Names dialog when you click the To... button on an
email message?

I can obviously do this manually by typing in the name and showing results
from the Global Address List, but I could have hundreds to do and I would
love to populate a table automatically behind the scenes.

Thanks in advance,
Clint



.

  #4  
Old November 16th 09, 04:27 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Finding an email address based on a name

After you successfully call Recipient.Resolve, Recipeint.Address will give
you what you need.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"cherman" wrote in message
...
Thank you. I can get the code to work with my existing code and get the
test
to pan out (that the recipient is in the address book), but how do I
capture
the actual email address?

Thanks again!
Clint


"Dmitry Streblechenko" wrote:

Use Namespace.CreateRecipient, followed by Recipient.Resolve

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"cherman" wrote in message
...
Hi there. I am working in Access 2003 with a reference to Outlook 2003.
Is
there a way in VBA to find an email address based on a name? Maybe
something
like using the Select Names dialog when you click the To... button on
an
email message?

I can obviously do this manually by typing in the name and showing
results
from the Global Address List, but I could have hundreds to do and I
would
love to populate a table automatically behind the scenes.

Thanks in advance,
Clint



.



  #5  
Old November 17th 09, 05:28 AM posted to microsoft.public.outlook.program_vba
cherman
external usenet poster
 
Posts: 4
Default Finding an email address based on a name

Hi there again. When I use this, I get a string like these.

..../ou=Exchange Administrative Group
(FYDIBOHF23SPDLT)/cn=Recipients/cn=cghermaX

..../OU=Americas01/cn=Recipients/cn=dmahesh

Although I can use the name or alias to populate an email, I really need the
actual email address. I've been looking online, but I just can't seem to
figure this out.

Any suggestions?

Thanks,
Clint


"Dmitry Streblechenko" wrote:

After you successfully call Recipient.Resolve, Recipeint.Address will give
you what you need.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"cherman" wrote in message
...
Thank you. I can get the code to work with my existing code and get the
test
to pan out (that the recipient is in the address book), but how do I
capture
the actual email address?

Thanks again!
Clint


"Dmitry Streblechenko" wrote:

Use Namespace.CreateRecipient, followed by Recipient.Resolve

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"cherman" wrote in message
...
Hi there. I am working in Access 2003 with a reference to Outlook 2003.
Is
there a way in VBA to find an email address based on a name? Maybe
something
like using the Select Names dialog when you click the To... button on
an
email message?

I can obviously do this manually by typing in the name and showing
results
from the Global Address List, but I could have hundreds to do and I
would
love to populate a table automatically behind the scenes.

Thanks in advance,
Clint


.



.

  #6  
Old November 17th 09, 05:38 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Finding an email address based on a name

That *is* the actual e-mail address. It just happens to be of EX type, while
you probably need SMTP.
If you are using Outlook 2007 or higher, you can use
ExchangeUser.PrimarySmtpAddress property (ExchangeUser object is returned by
the AddressEntry.GetExchangeUser method, which can return null).

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"cherman" wrote in message
...
Hi there again. When I use this, I get a string like these.

.../ou=Exchange Administrative Group
(FYDIBOHF23SPDLT)/cn=Recipients/cn=cghermaX

.../OU=Americas01/cn=Recipients/cn=dmahesh

Although I can use the name or alias to populate an email, I really need
the
actual email address. I've been looking online, but I just can't seem to
figure this out.

Any suggestions?

Thanks,
Clint


"Dmitry Streblechenko" wrote:

After you successfully call Recipient.Resolve, Recipeint.Address will
give
you what you need.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"cherman" wrote in message
...
Thank you. I can get the code to work with my existing code and get the
test
to pan out (that the recipient is in the address book), but how do I
capture
the actual email address?

Thanks again!
Clint


"Dmitry Streblechenko" wrote:

Use Namespace.CreateRecipient, followed by Recipient.Resolve

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"cherman" wrote in message
...
Hi there. I am working in Access 2003 with a reference to Outlook
2003.
Is
there a way in VBA to find an email address based on a name? Maybe
something
like using the Select Names dialog when you click the To... button
on
an
email message?

I can obviously do this manually by typing in the name and showing
results
from the Global Address List, but I could have hundreds to do and I
would
love to populate a table automatically behind the scenes.

Thanks in advance,
Clint


.



.



  #7  
Old November 20th 09, 09:17 PM posted to microsoft.public.outlook.program_vba
cherman
external usenet poster
 
Posts: 4
Default Finding an email address based on a name

Thanks a lot for your continued help. Sorry, but as I mentioned before, I'm
using Outlook 2003.

I mentioned in a previous post that I know what is returned is an actual
email address. This will work just fine for my internal needs. However, my
users will be exporting contact lists that will go all over the place, so the
SMTP address is the only one that will do. We cannot pass something like
"Clint Herman" outside of our own Exchange environment as an email address.

Any more suggestions? I thought it would be easy to get the SMTP. Maybe it
is and I just can't seem to hit the target. Is there somewhere online that
has a complete example of this?

Thanks again!
Clint

"Dmitry Streblechenko" wrote:

That *is* the actual e-mail address. It just happens to be of EX type, while
you probably need SMTP.
If you are using Outlook 2007 or higher, you can use
ExchangeUser.PrimarySmtpAddress property (ExchangeUser object is returned by
the AddressEntry.GetExchangeUser method, which can return null).

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"cherman" wrote in message
...
Hi there again. When I use this, I get a string like these.

.../ou=Exchange Administrative Group
(FYDIBOHF23SPDLT)/cn=Recipients/cn=cghermaX

.../OU=Americas01/cn=Recipients/cn=dmahesh

Although I can use the name or alias to populate an email, I really need
the
actual email address. I've been looking online, but I just can't seem to
figure this out.

Any suggestions?

Thanks,
Clint


"Dmitry Streblechenko" wrote:

After you successfully call Recipient.Resolve, Recipeint.Address will
give
you what you need.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"cherman" wrote in message
...
Thank you. I can get the code to work with my existing code and get the
test
to pan out (that the recipient is in the address book), but how do I
capture
the actual email address?

Thanks again!
Clint


"Dmitry Streblechenko" wrote:

Use Namespace.CreateRecipient, followed by Recipient.Resolve

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"cherman" wrote in message
...
Hi there. I am working in Access 2003 with a reference to Outlook
2003.
Is
there a way in VBA to find an email address based on a name? Maybe
something
like using the Select Names dialog when you click the To... button
on
an
email message?

I can obviously do this manually by typing in the name and showing
results
from the Global Address List, but I could have hundreds to do and I
would
love to populate a table automatically behind the scenes.

Thanks in advance,
Clint


.



.



.

  #8  
Old November 22nd 09, 05:46 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Finding an email address based on a name

If you cannot use Outlook 2007, your only options are either Extended MAPI
(C++/Delphi) or plug Redemption: it exposes SmtpAddress propertty in all
versions of Outlook - you can use somethng like the following:

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set AddrEntry = Session.AddressBook.ResolveName("dmitry streblechenko")
strSmtpAddress = AddrEntry.SmtpAddress
MsgBox strSmtpAddress

/plug

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"cherman" wrote in message
...
Thanks a lot for your continued help. Sorry, but as I mentioned before,
I'm
using Outlook 2003.

I mentioned in a previous post that I know what is returned is an actual
email address. This will work just fine for my internal needs. However, my
users will be exporting contact lists that will go all over the place, so
the
SMTP address is the only one that will do. We cannot pass something like
"Clint Herman" outside of our own Exchange environment as an email
address.

Any more suggestions? I thought it would be easy to get the SMTP. Maybe it
is and I just can't seem to hit the target. Is there somewhere online that
has a complete example of this?

Thanks again!
Clint

"Dmitry Streblechenko" wrote:

That *is* the actual e-mail address. It just happens to be of EX type,
while
you probably need SMTP.
If you are using Outlook 2007 or higher, you can use
ExchangeUser.PrimarySmtpAddress property (ExchangeUser object is returned
by
the AddressEntry.GetExchangeUser method, which can return null).

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"cherman" wrote in message
...
Hi there again. When I use this, I get a string like these.

.../ou=Exchange Administrative Group
(FYDIBOHF23SPDLT)/cn=Recipients/cn=cghermaX

.../OU=Americas01/cn=Recipients/cn=dmahesh

Although I can use the name or alias to populate an email, I really
need
the
actual email address. I've been looking online, but I just can't seem
to
figure this out.

Any suggestions?

Thanks,
Clint


"Dmitry Streblechenko" wrote:

After you successfully call Recipient.Resolve, Recipeint.Address will
give
you what you need.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"cherman" wrote in message
...
Thank you. I can get the code to work with my existing code and get
the
test
to pan out (that the recipient is in the address book), but how do I
capture
the actual email address?

Thanks again!
Clint


"Dmitry Streblechenko" wrote:

Use Namespace.CreateRecipient, followed by Recipient.Resolve

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"cherman" wrote in message
...
Hi there. I am working in Access 2003 with a reference to Outlook
2003.
Is
there a way in VBA to find an email address based on a name?
Maybe
something
like using the Select Names dialog when you click the To...
button
on
an
email message?

I can obviously do this manually by typing in the name and
showing
results
from the Global Address List, but I could have hundreds to do and
I
would
love to populate a table automatically behind the scenes.

Thanks in advance,
Clint


.



.



.



 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
moving emails to folders based on sender email address Rudy L. Outlook and VBA 1 December 31st 08 12:14 PM
Finding Old Contacts not in address book Meira Outlook - Using Contacts 2 September 18th 08 04:32 AM
Automaticly change outgoing isp based on sel email address - revisited pfa Outlook and VBA 0 September 14th 06 01:01 AM
Automaticly change outgoing isp based on sel email address Paul T. Swaffer Outlook and VBA 4 July 16th 06 02:17 PM


All times are GMT +1. The time now is 03:37 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.