When a client syncs his iPhone contacts to Outlook, the mailing address is set to Other address. While you can open each contact and change the mailing address, it's a lot faster to use PowerShell.
As currently configured, this script uses the selected contacts folder, but it could be changed to use the default contacts folder and sets the Home address as the mailing address.
To use, open PowerShell IDE and paste the code into it. Select the contacts folder in classic Outlook then click Run. I have a video showing how to use PowerShell at the end of this article.
$olApp = new-object -comobject outlook.application $namespace = $olApp.GetNamespace("MAPI") # Default Contacts folder #$Contacts = $namespace.GetDefaultFolder(10) # Uses current folder $Contacts = ($olApp.ActiveExplorer()).CurrentFolder foreach ($Contact in $Contacts.Items) { # Change only contacts if ($Contact.messageclass -like "IPM.Contact*") { # valid values are # 2 Business # 1 Home # 0 No mailing address # 3 Other $Contact.SelectedMailingAddress = 1 $Contact.Save() } } $olApp.Quit | Out-Null [GC]::Collect()
Move the Mailing address to a different address field
If you want to move the address from business to home, use this code snippet:
Valid addresses are HomeAddress, BusinessAddress, OtherAddress.
$olApp = new-object -comobject outlook.application $namespace = $olApp.GetNamespace("MAPI") # Default Contacts folder #$Contacts = $namespace.GetDefaultFolder(10) # Uses current folder $Contacts = ($olApp.ActiveExplorer()).CurrentFolder foreach ($Contact in $Contacts.Items) { if ($Contact.messageclass -like "IPM.Contact*") { # Check to see if field is empty if ($Contact.HomeAddress -like "") { $Contact.HomeAddress = $Contact.BusinessAddress # To clear the address field you copied from $Contact.BusinessAddress = "" # valid values are # 2 Business # 1 Home # 0 No mailing address # 3 Other $Contact.SelectedMailingAddress = 1 $Contact.Save() } } } $olApp.Quit | Out-Null [GC]::Collect()
Using PowerShell Scripts
To use PowerShell scripts with Outlook, start typing PowerShell on the start menu and open Windows PowerShell when it comes up. Windows PowerShell ISE has a script pane at the top, which is useful if you want to edit the script.
If you are using PowerShell ISE and don't see the white pane at the top, click the V icon in the upper right.
Note: PowerShell scripts will not work with new Outlook or Outlook on the web.
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.
More Information
A VBA version is here:
Show the Home Address on a Contact Form by Default