Tuesday, 9 December 2014

Migrate managed metadata between farms


Everybody loves working with managed metadata but one of the challenges you eventually will have to deal with, is the challenge of moving this managed metadata from one farm to another. You might want to put a copy of a production environment into the development environment. Or you have a so-called “test” environment which is used by users to fill content and then you have to move everything to production.
Sure, you can export your managed metadata and import it into your other farm but the problem is that each termset and term has a GUID and when you import that data into your new farm, new GUID’s will be assigned to them. If you move the rest of your content to your new farm, your managed metadata columns, which point to those termsets won’t work anymore in your new farm because the GUID of the termset it links to, has changed. You have to hook them up again to the correct termset. Furthermore, existing items which already have values in those fields also need to be hooked up again. The value looks the same, but the ID is not and when you open the properties of such an item, SharePoint will not be able to resolve that value against the term store.

So, how do you move your managed metadata and keep the ID’s? It’s actually quite easy using PowerShell.

Export data

 $mmsApplication = Get-SPServiceApplication | ? {$_.TypeName -eq "Managed Metadata Service"}
$mmsProxy = Get-SPServiceApplicationProxy | ? {$_.TypeName -eq "Managed Metadata Service Connection"}
Export-SPMetadataWebServicePartitionData $mmsApplication.Id -ServiceProxy $mmsProxy -Path "\\server\share\mmsdata.cab"

Copy this file to a location which is accessible to the database server of your destination farm.
make sure that the service account which is used to run the Managed Metadata Service has the “BulkAdmin” server role in SQL Server. This is role is only needed for the import. You can remove it afterwards.
 

Import data

$mmsApplication = Get-SPServiceApplication | ? {$_.TypeName -eq "Managed Metadata Service"}
$mmsProxy = Get-SPServiceApplicationProxy | ? {$_.TypeName -eq "Managed Metadata Service Connection"}
Import-SPMetadataWebServicePartitionData $mmsApplication.Id -ServiceProxy $mmsProxy -Path "\\server\share\mmsdata.cab" -OverwriteExisting


When you compare the termsets and terms of both farms, you will see that the ID’s are the same. Now you can move your content and your managed metadata columns will be working just fine.

Reference:

http://blog.kuppens-switsers.net/sharepoint/migrate-managed-metadata-between-farms/

No comments:

Post a Comment