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

Sue Mosher [MVP]

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

JohnLee

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

Sue Mosher [MVP]

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
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 New Slipstick.com Articles 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 New Slipstick.com Articles 0
Z Outlook 2007, clicking email addresses fails to open Contact Using Outlook 0
Diane Poremsky Send email to all addresses for one Contact New Slipstick.com Articles 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 Disable Contact Card Results when using "Search People" in Outlook Ribbon Using Outlook 7
M Contact suggestion Using Outlook 2
H Custom Outlook Contact Form VBA Outlook VBA and Custom Forms 1
witzker HowTo Change message Class of contact form Outlook VBA and Custom Forms 0
witzker Open Contact missing in Outlook 2019 Using Outlook 2
witzker HowTo start a macro with an Button in OL contact form Outlook VBA and Custom Forms 12
witzker Pls help to change the code for inserting date in Ol contact body Outlook VBA and Custom Forms 5
R Time for another article on contact cards? Using Outlook 0
O Create a custom contact form - questions before messing things up... Outlook VBA and Custom Forms 4
M vCard does not have user-defined fields from my custom contact form (365) Using Outlook 1
C Copy Outlook contact field value to another field Outlook VBA and Custom Forms 1
W Remove specific contacts from contact list Outlook VBA and Custom Forms 3
GregS 2016 Contact List being managed by Outlook.com? Using Outlook 1
F Copy and replace not update contact in another pst Using Outlook 0
A Sending contact vcards sends older version instead of updated version Using Outlook 4
T Outlook 2010 Correct way to map multiple contact fields Using Outlook 4
Victor_50 Outlook 2013 Custom Contact Form starts with "E-mail 2" Outlook VBA and Custom Forms 2
B Outlook Business Contact Manager with SQL to Excel, User Defined Fields in BCM don't sync in SQL. Can I use VBA code to copy 1 field to another? BCM (Business Contact Manager) 0
L dynamic and static dates in Outlook contact "notes" ie. body Using Outlook 2
L Wierd Office 365 Contact unable to edit body of random contacts Using Outlook 5
M Contact photos are distorted Using Outlook 0
C Outlook Contact Manager - A viable successor? BCM (Business Contact Manager) 7
N Contact display as Using Outlook 2
N contact notepad 'style' getting changed after clicking and running Activities Using Outlook 2
N How to turn off autocorrect in contact notepads Using Outlook 2

Similar threads

Top