Update SMTP Primary Address for Migrated Public Folder

 Office 365, Exchange Online, Perumal
Oct 27 2015
Public Folder is a feature available in both Microsoft Exchange on-premises and Office365. Public Folders are used to share information within your organization. Public Folders can hold messages, notes, calendar etc. Usually Public Folders are important asset that needs to be maintained during the Office365 migration.

After the public folders are migrated to Office365, the primary smtp address will be of form 'yourdomain.onmicrosoft.com'. And administrators want to fix the email address back to their domain name 'yourdomain.com'. In this blog post we shall check how to change the primary smtp address for the public folders.
  1. Get all the public folders
  2. Replace the primary smtp address to point to your domain
To get all the public folders we need to use powershell command 'Get-MailPublicFolder'.
To change the primary smtp address, we need to use 'Set-MailPublicFolder' command.
  Get-MailPublicFolder | 
  % { Set-MailPublicFolder -Identity $_.identity 
  -PrimarySmtpAddress $_.PrimarySmtpAddress.Replace("jijitechnologies.onmicrosoft.com","jijitechnologies.com") 
  -EmailAddressPolicyEnabled $false 
   }
                        

In the above script we are retrieving all the mail enabled public folder and replacing the primary smtp address alone using Set-MailPublicFolder. In the script replace the domain name with your domain name accordingly.