Thursday, February 14, 2013

Refreshing Email Enabled Lists after Migration

Anytime you move your content databases to a farm using the database attach method in SharePoint 2010 (and i'm guessing SharePoint 2013) you need will need to refresh all of your email enabled lists.  The reason for this is because SharePoint stores the email enabled lists inside of the Farm Configuration Database and since the Farm Configuration database doesn't move during a database attach migration you need to refresh all of your email enabled lists back into the Farm Configuration Database.  The best way to do this is with a short script that will iterate through all sites and perform this function.  Here is the code to perform this action:

Add-PSSnapin Microsoft.SharePoint.PowerShell -ea 0
 
$sites = Get-SPSite -LIMIT all
 
foreach ($site in $sites) {
  $site.RefreshEmailEnabledObjects()
  $site.Dispose()
}

I found this code on this blog and he has a very good write on this issue: http://get-spchopps.com/post/2012/08/23/Fixing-Incoming-Email-after-Migration-to-SharePoint-2010.aspx.

I made a slight modification to the script that enables it to enurmate all sites in your farm and not just using a limited result set. 

No comments: