Contact Email address format

Status
Not open for further replies.
J

JohnLee

Hi!

I'm trying to programmatically access the my contacts from outlook, which I

did using the following code:

var outlookApplication = new ApplicationClass();

NameSpace mapiNamespace = outlookApplication.GetNamespace("MAPI");

MAPIFolder searchFolder =

mapiNamespace.GetDefaultFolder(OlDefaultFolders.olFolderContacts);

The problem is that any email address (Email1Address) retrieved which is

connected to the same local Microsoft exchange server is retrieved in the

following format:

/o=First Organization/ou=Exchange Administrative Group

(FYDIBHDO23SPDLT)/cn=Recipients/cn=John Lee

Is it possible to retrieve or somehow convert the address to the usual email

format (John.Lee@server.com) ?

I need to retrieve the certificate linked to the particular email, but as

far as I know it can only be correctly matched by searching by email address

(using the format John.Lee@server.com).
 
Outlook version?

Sue Mosher

"JohnLee" wrote:


> Hi!

> I'm trying to programmatically access the my contacts from outlook, which I
> did using the following code:

> var outlookApplication = new ApplicationClass();

> NameSpace mapiNamespace = outlookApplication.GetNamespace("MAPI");

> MAPIFolder searchFolder =
> mapiNamespace.GetDefaultFolder(OlDefaultFolders.olFolderContacts);

> The problem is that any email address (Email1Address) retrieved which is
> connected to the same local Microsoft exchange server is retrieved in the
> following format:

> /o=First Organization/ou=Exchange Administrative Group
> (FYDIBHDO23SPDLT)/cn=Recipients/cn=John Lee

> Is it possible to retrieve or somehow convert the address to the usual email
> format (John.Lee@server.com) ?

> I need to retrieve the certificate linked to the particular email, but as
> far as I know it can only be correctly matched by searching by email address
> (using the format John.Lee@server.com).
>
 
At the moment I'm working on outook 2007...

"Sue Mosher [MVP]" <suemvp@gmail.com> wrote in message

news:CC6C7B6F-A0E6-4491-8127-7252F61F6868@microsoft.com...
> Outlook version?
> > Sue Mosher
> > >

> "JohnLee" wrote:
>
> > Hi!
>

>> I'm trying to programmatically access the my contacts from outlook, which
> > I
> > did using the following code:
>

>> var outlookApplication = new ApplicationClass();
>

>> NameSpace mapiNamespace = outlookApplication.GetNamespace("MAPI");
>

>> MAPIFolder searchFolder =
> > mapiNamespace.GetDefaultFolder(OlDefaultFolders.olFolderContacts);
>

>
>
>> The problem is that any email address (Email1Address) retrieved which is
> > connected to the same local Microsoft exchange server is retrieved in the
> > following format:
>

>> /o=First Organization/ou=Exchange Administrative Group
> > (FYDIBHDO23SPDLT)/cn=Recipients/cn=John Lee
>

>
>
>> Is it possible to retrieve or somehow convert the address to the usual
> > email
> > format (John.Lee@server.com) ?
>

>> I need to retrieve the certificate linked to the particular email, but as
> > far as I know it can only be correctly matched by searching by email
> > address
> > (using the format John.Lee@server.com).
> >
 
For Outlook 2007 or later, once you get the address from the contact in X.400

(Exchange) format, use it as the argument for the Namespace.CreateRecipient

method to return a Recipient object. Then use the

Recipient.AddressEntry.GetExchangeUser method to return an ExchangeUser

object and get its PrimarySmtpAddress address:

Set recip = mapiNamespace.CreateRecipient(contactemail)

If recip.Resolved Then

Set ae = recip.AddressEntry

If ae.AddressEntryUserType = olExchangeUserAddressEntry Then

Set exUser = ae.GetExchangeUser

smtp = exUser.PrimarySmtpAddress

End If

End If

Sue Mosher

"JohnLee" wrote:


> At the moment I'm working on outook 2007...
> >
> >> I'm trying to programmatically access the my contacts from outlook, which
> >> I
> >> did using the following code:
> >
> >> var outlookApplication = new ApplicationClass();
> >
> >> NameSpace mapiNamespace = outlookApplication.GetNamespace("MAPI");
> >
> >> MAPIFolder searchFolder =
> >> mapiNamespace.GetDefaultFolder(OlDefaultFolders.olFolderContacts);
> >
> >> The problem is that any email address (Email1Address) retrieved which is
> >> connected to the same local Microsoft exchange server is retrieved in the
> >> following format:
> >
> >> /o=First Organization/ou=Exchange Administrative Group
> >> (FYDIBHDO23SPDLT)/cn=Recipients/cn=John Lee
> >
> >
> >
> >> Is it possible to retrieve or somehow convert the address to the usual
> >> email
> >> format (John.Lee@server.com) ?
> >
> >> I need to retrieve the certificate linked to the particular email, but as
> >> far as I know it can only be correctly matched by searching by email
> >> address
> >> (using the format John.Lee@server.com).
> >>

>
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
N contact list seen in Contact folder but knot in Address book or when 'TO' button is clicked in new email Using Outlook 0
G Create an Appointment at the Contact's Address From Email Outlook VBA and Custom Forms 0
D Unable to add email address to contact Using Outlook 3
J Outlook 2010 - email address disappears when setting up new contact Using Outlook 0
D Outlook 2010 - email address disappears when setting up new contact Using Outlook 3
E Double clicking on from email address does no longer open corresponding contact in Outlook 2007 Using Outlook 7
Witzker Outlook 2019 Macro to seach in all contact Folders for marked Email Adress Outlook VBA and Custom Forms 1
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
R Roadrunner Email Settings | Contact Roadrunner Customer Support Outlook VBA and Custom Forms 0
Randy Redekopp How To Merge Contact Info to Email Custom Form Template Using Outlook 2
R Outlook add-in to create new contact from an email. Using Outlook 0
P Skype contact icons have disappeared at the bottom of email and meeting objects Using Outlook 2
Diane Poremsky Add Email Addresses to a Contact Group Using Outlook 0
M creating email from contact file = 3 emails in To field Using Outlook 3
Diane Poremsky Assign an Email Account to an Outlook Contact Using Outlook 0
Z Outlook 2007, clicking email addresses fails to open Contact Using Outlook 0
Diane Poremsky Send email to all addresses for one Contact Using Outlook 0
N linking an already sent/rec'd email to contact record like it did in 2000 Using Outlook 0
L Email From Contact of Calendar Using Outlook 20
L Opening up Contact from an Email - Outlook 2007 Using Outlook 15
P Email Header/People pane/contact card - GAL photo vs. contact photo Using Outlook 7
K Change default "Display As" for contact email addresses Using Outlook 1
D No contact groups in email Using Outlook 4
K add an email to a business contact without linking/tracking sender BCM (Business Contact Manager) 0
S Contact Photo does not display in email messages. Using Outlook 3
R My email merge/business contact manager fields are not populating BCM (Business Contact Manager) 1
W email contacts from external contact database. BCM (Business Contact Manager) 1
T How do I get BCM to show up in the email contact field BCM (Business Contact Manager) 1
M Outlook changes the "Modified" field when moving/copying a Contact. Using Outlook 0
G Outlook 2021 Add Picture to Custom Contact Form Outlook VBA and Custom Forms 2
AndyZ Contact Custom Form Tiny Text Outlook VBA and Custom Forms 3
A How to reduce size of custom contact form? Outlook VBA and Custom Forms 3
S Custom Contact card - need help creating one Outlook VBA and Custom Forms 1
U Outlook 2021 not showing contact cards in Searches Using Outlook 1
Witzker How to get the button Karte ( map) in custom contact form Outlook VBA and Custom Forms 2
G Adding a contact to a specific folder Using Outlook 0
B Linking contact to an Appointment Using Outlook 1
Witzker Outlook 2019 How to get a Photo in a User Defined Contact form Outlook VBA and Custom Forms 2
jehan2256 "History" button in Business Contact Manager Using Outlook 1
Horsepower Contact phone numbers randomly change Using Outlook 0
Witzker Set Cursor & Focus from any field to the body of a user Contact form in OL 2019 Outlook VBA and Custom Forms 1
Witzker Place cursor at opening, a user defined OL contact form Outlook VBA and Custom Forms 3
M Contact deletion Using Outlook 2
M Accessing ALL Outlook contact fields Outlook VBA and Custom Forms 3
S Outlook 365 Shared mailbox contact group member numbers not matching Using Outlook 0
D Contact Group - Adding Bulk Addresses Using Outlook 2
F Outlook 365 No scroll bars in Contact Using Outlook 2
N Contact Form Notes Field Touch vs Mouse Using Outlook 0
J "Contact" button in Journal entry Using Outlook 1

Similar threads

Back
Top