Solved

How do you reset the "Display As" field for all existing Outlook Contacts?

Posted on 2008-10-03
4
319 Views
Last Modified: 2012-05-05
I am using the Outlook client on the front end with a Lotus Domino server on the backend. My Lotus Notes address book syncs to an Outllook Contact Address Book but the "Display As" field in the Outllok contacts only shows the users email address.  Is there a simple way to reset all existing contacts in my Outlook Address Book to display like this  

John Doe <jdoe@domain.com>

I know I can reset each individual one by deleting the "Display As" field and then clicking into another field and it will reset the Display As field.  However I have 600 contacts in my address book and don't want to do this manually.

Any help would be appreciated.
0
Comment
Question by:rdgit
  • 2
  • 2
4 Comments
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 22635875
Hello rdgit,

This should work, written to run from Outlook.

Regards,

Patrick
Sub ResetDisplayAs()
    
    Dim ns As NameSpace
    Dim fld As MAPIFolder
    Dim it As Variant
    Dim c As ContactItem
    
    Set ns = Application.GetNamespace("MAPI")
    Set fld = ns.GetDefaultFolder(olFolderContacts)
    
    For Each it In fld.Items
        If it.Class = olContactItem Then
            Set c = it
            c.FileAs = c.FullName & " <" & c.Email1Address & ">"
            c.Save
        End If
    Next
    
End Sub

Open in new window

0
 

Author Comment

by:rdgit
ID: 22637167
Thanks for the quick reply.

I have loaded the macro in outlook but when I run it, nothing happens.
I am new to outlook so I may be doing something wrong.
I go into the Contacts view then click Tools..Macro..Macro.
I then select ResetDisaplayAs and click Run.
the dialog box goes away but nothing changes.

I have tried selecting multiple contact and  then running it but it doesn't do anything either.

Am I doing something wrong?
Thanks!

0
 

Author Comment

by:rdgit
ID: 22652753
Hello,
I was able to verify that Im running it, its searching through each of my contacts but when it gets to the IF statement, it isnt seeing something correctly... ( If it.Class = olContactItem Then)& olContatitem is always at a value of 2?  I also noticed that the & c & or the contact item& never has a value, so even if I took the if statement out it wouldnt be able to set it to anything.  Any help you could provide would be great!

0
 
LVL 92

Accepted Solution

by:
Patrick Matthews earned 50 total points
ID: 22743284
rdgit,

Sorry for the delay.  I was using the wrong value for the class type.  I tested the snippet below, and it
appears to work.

Regards,

Patrick
Sub ResetDisplayAs()
    
    Dim ns As NameSpace
    Dim fld As MAPIFolder
    Dim it As Variant
    Dim c As ContactItem
    
    Set ns = Application.GetNamespace("MAPI")
    Set fld = ns.GetDefaultFolder(olFolderContacts)
    
    For Each it In fld.Items
        If it.Class = olContact Then
            Set c = it
            c.FileAs = c.FullName & " <" & c.Email1Address & ">"
            c.Save
            Debug.Print c.FileAs   'for debugging
            Exit For               'for debugging
        End If
    Next
    
    Set fld = Nothing
    Set ns = Nothing
    
End Sub

Open in new window

0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Problem to With line 4 43
Excel 2016 - Black cell borders 11 28
exchange, outlook 2 26
Send automatic reply to outside email address via Outlook 2013 or Exchange 2013 ECP 6 77
If you don't know how to downgrade, my instructions below should be helpful.
Large Outlook files lead to various unwanted errors and corruption issues. Furthermore, large outlook files can also make Outlook take longer to start-up, search, navigate, and shut-down. So, In this article, i will discuss a method to make your Out…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now