I have a series of macros that can bulk change contacts, but using a macro is not the only way to bulk change contacts. You can make the same changes using a PowerShell script.
Any Outlook field can be manipulated using PowerShell. This script sample changes the File As and Email Display Name field of the Contacts in the Default Contacts folder to match the Full Name field.
To use, right-click on the Start menu in Windows 10 and click on the Windows PowerShell entry. Paste the entire script in the PowerShell window and press Enter.
Note: This PowerShell script will not work with the Windows Store version of Office. You'll need to use the macro version if you have the Windows store version of Office installed.
Like the Bulk Change Email Display Name Format macro, the PowerShell version uses the default FileAs format or a custom format. Use the same method to change other Outlook fields.
Change the Email Display Name field
This PowerShell changes the email display name field for Email1. You can tweak it to change the display names for change Email2 and Email3 as well.
$olApp = new-object -comobject outlook.application $namespace = $olApp.GetNamespace("MAPI") # Default Contacts folder $Contacts = $namespace.GetDefaultFolder(10) foreach ($Contact in $Contacts.Items) { # Change only contacts with SMTP address if ($Contact.Email1Address -like "*@*") { # Uncomment the file as format you want #Lastname, Firstname (Company) format # $newFileAs = $Contact.FullNameAndCompany #Firstname Lastname format # $newFileAs = $Contact.FullName #Lastname, Firstname format # $newFileAs = $Contact.LastNameAndFirstName #Company name only # $newFileAs = $Contact.CompanyName #Companyname (Lastname, Firstname) # $newFileAs = $Contact.CompanyAndFullName # Custom format $newFileAs = $Contact.CompanyName + " (" + $Contact.FullName + ")" # Comment out lines if you don't want to change the field # $Contact.FileAs = $Contact.CompanyAndFullName $Contact.Email1DisplayName = $newFileAs $Contact.Save() } } $olApp.Quit | Out-Null [GC]::Collect()
Swap First and Last Name fields
To swap fields, you need to add the current field value to a variable then add them to the other field. Don't forget to Save the contact!
The macro version of this script is at Macro to Swap First and Last Name Fields
$olApp = new-object -comobject outlook.application $namespace = $olApp.GetNamespace("MAPI") # Default Contacts folder $Contacts = $namespace.GetDefaultFolder(10) foreach ($Contact in $Contacts.Items) { $curFirstName = $Contact.FirstName $CurLastName = $Contact.lastname $Contact.FirstName = $CurLastName $Contact.LastName = $curFirstName $Contact.Save() } $olApp.Quit | Out-Null [GC]::Collect()
Saving PowerShell Scripts
If you want to save the script as a .ps1 file, paste it into Notepad and save it with the extension .ps1. To open it in the PowerShell IDE, type powershell on the start menu and click on Windows PowerShell IDE when the PowerShell app is found. Paste the script in the editing window.
To use it, you need to allow local scripts by running this command:
Set-ExecutionPolicy RemoteSigned
To run your saved .ps1 file, right-click on the script and choose Run with PowerShell.