While moving a site from development environment to production environment, it is recommended to move MMS term stores too. We can actually adopt two approaches to this:
1. Export Term Stores in a .csv file and then Import them to target server.
2. Use a powershell script to create a .cab file to import on target server.
The first approach is easier but has a major drawback. It does not persist the GUID of the terms. This may lead to many errors in the imported site because some web parts might be dependent on a term's guid.
e.g. if i have a CQWP which shows filtered data as per a MMS term, then in the target server the filtering would be lost.
So a better and safe way is to export and import MMS using Powershell:
Export
Add-PSSnapin Microsoft.SharePoint.Powershell
$metadataApp= Get-SpServiceApplication | ? {$_.TypeName -eq "Managed Metadata Service"}
$mmsAppId = $metadataApp.Id
$mmsproxy = Get-SPServiceApplicationProxy | ?{$_.TypeName -eq "Managed Metadata Service Connection"}
Export-SPMetadataWebServicePartitionData -Identity $mmsAppId -ServiceProxy $mmsproxy -Path "C:\Users\Desktop\MMD.cab”
Import
Add-PSSnapin Microsoft.SharePoint.Powershell
$metadataApp= Get-SpServiceApplication | ? {$_.TypeName -eq "Managed Metadata Service"}
$mmsAppId = $metadataApp.Id
$mmsproxy = Get-SPServiceApplicationProxy | ?{$_.TypeName -eq "Managed Metadata Service Connection"}
Import-SPMetadataWebServicePartitionData -Identity $mmsAppId -ServiceProxy $mmsproxy -Path "//SharedPath/Users/Desktop/MMD.cab" -OverwriteExisting;
NOTE: While importing make sure the .cab file is in a network path accessible to SQL Server with ContentDB and which has been shared with the user account of the MMS Service.
1. Export Term Stores in a .csv file and then Import them to target server.
2. Use a powershell script to create a .cab file to import on target server.
The first approach is easier but has a major drawback. It does not persist the GUID of the terms. This may lead to many errors in the imported site because some web parts might be dependent on a term's guid.
e.g. if i have a CQWP which shows filtered data as per a MMS term, then in the target server the filtering would be lost.
So a better and safe way is to export and import MMS using Powershell:
Export
Add-PSSnapin Microsoft.SharePoint.Powershell
$metadataApp= Get-SpServiceApplication | ? {$_.TypeName -eq "Managed Metadata Service"}
$mmsAppId = $metadataApp.Id
$mmsproxy = Get-SPServiceApplicationProxy | ?{$_.TypeName -eq "Managed Metadata Service Connection"}
Export-SPMetadataWebServicePartitionData -Identity $mmsAppId -ServiceProxy $mmsproxy -Path "C:\Users\Desktop\MMD.cab”
Import
Add-PSSnapin Microsoft.SharePoint.Powershell
$metadataApp= Get-SpServiceApplication | ? {$_.TypeName -eq "Managed Metadata Service"}
$mmsAppId = $metadataApp.Id
$mmsproxy = Get-SPServiceApplicationProxy | ?{$_.TypeName -eq "Managed Metadata Service Connection"}
Import-SPMetadataWebServicePartitionData -Identity $mmsAppId -ServiceProxy $mmsproxy -Path "//SharedPath/Users/Desktop/MMD.cab" -OverwriteExisting;
NOTE: While importing make sure the .cab file is in a network path accessible to SQL Server with ContentDB and which has been shared with the user account of the MMS Service.




Solid script - thank you for this!
ReplyDeleteNote: I did have a permission error thrown when exporting however this turned out to just be a filesystem permission issue with the folder I was trying to save to. I just a new folder in the root of C and it worked perfectly.
Welcome...Nice to know it helped!
DeleteHi, great and very useful script. However, I ended up using a product called serviceaware Term Store Sync (www.serviceaware.com) to move term groups from one environment to another, as I needed to retain the GUIDs and custom properties.
ReplyDeleteWe Provide the Best WordPress SMS Service Visit this Link
ReplyDeleteWordPress SMS
Can this be used to migrate termstore data from SP2010 to SP2013? Anyone tried this?
ReplyDelete