Finding an email address based on a name

Status
Not open for further replies.
C

cherman

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
 
D

Dmitry Streblechenko

Use Namespace.CreateRecipient, followed by Recipient.Resolve

Dmitry Streblechenko (MVP)

-

"cherman" <cherman> wrote in message

news:B5F1D65E-1421-495E-B174-D10EF49573BB@microsoft.com...
> 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
 
C

cherman

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)
>

>

>

> -
> "cherman" <cherman> wrote in message
> news:B5F1D65E-1421-495E-B174-D10EF49573BB@microsoft.com...
> > 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


> .
>
 
D

Dmitry Streblechenko

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

you what you need.

Dmitry Streblechenko (MVP)

-

"cherman" <cherman> wrote in message

news:51B3F062-27D0-4106-973B-871BE93A9D3E@microsoft.com...
> 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)
> >

> >

> >

> > -
> > "cherman" <cherman> wrote in message
> > news:B5F1D65E-1421-495E-B174-D10EF49573BB@microsoft.com...
> > > 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

>

>
>> .
> >
 
C

cherman

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)
>

>

>

> -
> "cherman" <cherman> wrote in message
> news:51B3F062-27D0-4106-973B-871BE93A9D3E@microsoft.com...
> > 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)
> >>

> >>

> >>

> >> -
> >> "cherman" <cherman> wrote in message
> >> news:B5F1D65E-1421-495E-B174-D10EF49573BB@microsoft.com...
> >> > 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
> >
> >
> >> .
> >>


> .
>
 
D

Dmitry Streblechenko

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)

-

"cherman" <cherman> wrote in message

news:424EB34F-F72F-466C-8357-2A11E2CDA358@microsoft.com...
> 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)
> >

> >

> >

> > -
> > "cherman" <cherman> wrote in message
> > news:51B3F062-27D0-4106-973B-871BE93A9D3E@microsoft.com...
> > > 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)
> > >>

> > >>

> > >>

> > >> -
> > >> "cherman" <cherman> wrote in message
> > >> news:B5F1D65E-1421-495E-B174-D10EF49573BB@microsoft.com...
> > >> > 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
> > >
>> >
>> >> .
> > >>

>

>
>> .
> >
 
C

cherman

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)
>

>

>

> -
> "cherman" <cherman> wrote in message
> news:424EB34F-F72F-466C-8357-2A11E2CDA358@microsoft.com...
> > 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)
> >>

> >>

> >>

> >> -
> >> "cherman" <cherman> wrote in message
> >> news:51B3F062-27D0-4106-973B-871BE93A9D3E@microsoft.com...
> >> > 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)
> >> >>

> >> >>

> >> >>

> >> >> -
> >> >> "cherman" <cherman> wrote in message
> >> >> news:B5F1D65E-1421-495E-B174-D10EF49573BB@microsoft.com...
> >> >> > 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
> >> >
> >> >
> >> >> .
> >> >
> >
> >
> >> .
> >>


> .
>
 
D

Dmitry Streblechenko

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)

-

"cherman" <cherman> wrote in message

news:FBCDF366-B609-4F9D-B225-4251A8CE682B@microsoft.com...
> 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)
> >

> >

> >

> > -
> > "cherman" <cherman> wrote in message
> > news:424EB34F-F72F-466C-8357-2A11E2CDA358@microsoft.com...
> > > 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)
> > >>

> > >>

> > >>

> > >> -
> > >> "cherman" <cherman> wrote in message
> > >> news:51B3F062-27D0-4106-973B-871BE93A9D3E@microsoft.com...
> > >> > 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)
> > >> >>

> > >> >>

> > >> >>

> > >> >> -
> > >> >> "cherman" <cherman> wrote in message
> > >> >> news:B5F1D65E-1421-495E-B174-D10EF49573BB@microsoft.com...
> > >> >> > 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
> > >> >
>> >> >
>> >> >> .
> > >> >
>> >
>> >
>> >> .
> > >>

>

>
>> .
> >
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
P finding a folder containing an email item Using Outlook 0
S Finding an inbox email question Outlook VBA and Custom Forms 2
bhamberg Finding a rouge rule... Using Outlook 6
K Outlook.com is not showing, or finding via search, all my Contacts (People) Using Outlook 0
A ScanPST finding errors but no Repair button Using Outlook 2
F Finding Meetings/Tasks in a date range Using Outlook 1
M Finding Tasks in Outlook 365 Using Outlook 1
A "search people" not finding all contacts Using Outlook 17
Commodore Finding items from last 7 days Using Outlook 2
T Need help with finding/updating task Outlook VBA and Custom Forms 1
M Finding a folder by name Outlook 2013 Using Outlook 4
S Finding Distribution List Name Outlook VBA and Custom Forms 3
Ron Kirschner Finding a rule Using Outlook 1
A OL13 Calendar Search not finding most items Using Outlook 15
L Finding deleted contact from shared folder. Exchange Server Administration 1
G finding Outlook 2010 pst in Windows XP Using Outlook 2
N Finding messages by conversation macro Outlook VBA and Custom Forms 1
M Outlook VBA Form not finding FOR LOOP -- Error message Outlook VBA and Custom Forms 2
B Outlook 2019 Custom Email form - Edit default email form Outlook VBA and Custom Forms 6
F Add a category before "Send an Email When You Add an Appointment to Your Calendar" Outlook VBA and Custom Forms 0
T Problem when requesting to view an email in a browser Using Outlook 0
J Outlook 365 Forward Email Subject to my inbox when new email arrive in shared inbox Using Outlook 0
HarvMan Archive Email Manually Using Outlook 1
L Fetch, edit and forward an email with VBA outlook Outlook VBA and Custom Forms 2
S New Email "From" box stopped working Using Outlook 0
Rupert Dragwater Duplicate email in Folder Using Outlook 7
M "Attachment Detacher for Outlook" add in, does it update the server copy of the email? Using Outlook 1
W Outlook 365 I am getting the "Either there is no default mail client" error when I try to send an email on excel Office 365 Using Outlook 1
MattC Changing the font of an email with VBA Outlook VBA and Custom Forms 0
L Specific Incoming Email Address Immediately Deleted Using Outlook 2
Witzker Outlook 2019 Macro to send an Email Template from User Defined Contact Form Outlook VBA and Custom Forms 0
Witzker Outlook 2019 Edit contact from email does not open the user defined contactform Using Outlook 3
V Macro to mark email with a Category Outlook VBA and Custom Forms 4
R Roadrunner Email Settings | Contact Roadrunner Customer Support Outlook VBA and Custom Forms 1
D Gmail mail is being delivered to a different email inbox in Outlook App 2021 Using Outlook 2
Albert McCann Outlook 2021 Outlook Display of HTML Email from two senders is glitchy Using Outlook 0
A How Do I Setup My Optonline.Net Email Account? Outlook VBA and Custom Forms 1
H Preventing the 'email address fetch from Exchange' crashing email reading code Exchange Server Administration 0
D multiple email accounts - why do I have to choose the "from" account address?? Using Outlook 2
Wotme create email only data file Using Outlook 1
F Outlook 2016 Email with attachments not being received Using Outlook 3
J Outlook 2019 Regex email addresses from body Outlook VBA and Custom Forms 6
D Prompt to prefix subject line whenever sending an email Outlook VBA and Custom Forms 3
J Quick steps delete original email and move reply/sent email to folder Using Outlook 2
C Wishlist Extract or scan new email addresses from out of office replies. Leads from OOO replies Using Outlook 1
T External email warning banner Outlook VBA and Custom Forms 0
A Links in email getting error message about group policy Using Outlook 4
richardwing Auto forward email that is moves into a specific outlook folder Outlook VBA and Custom Forms 5
J Recommendations for Outlook Duplicate Email Remover Using Outlook 6
Geldner Tweak Junk Email Reporting tool to default to particular email on send? Using Outlook 3

Similar threads

Top