Wednesday, April 17, 2013

Import/Export SharePoint Managed Metadata Termsets

I recently worked in a project where I had to use Managed Metadata Terms in several different SPFarms.

However, I had to guarantee that all TermSets/Terms had the same GUIDs associated across all environments.

To accomplish this, I used a great project from codeplex called spmmdnavigator.

This tool allows to Export existing TermSets to a file format (i.e. XML), and then import the same in other farms. What is great about this tool, is that it keeps the GUIDs of the Terms when the Terms are Imported.

The tool works great for what we intended, but we had some initial issues getting it to work.
The main issue we had was when we tried to import TermSets after having exported them to XML.
The error message we got over and over was:
"[12:00:00] ERROR : Specified argument was out of the range of valid values.
Parameter name: lcid"

After downloading the source code from the spmmdnavigator project, we found that the problem we were having was that the machine where we ran the tool to import the TermSets was configured in a different Regional Setting from that of the SharePoint farm.
Therefore, what was happening was that API calls were being made to retrieve the Terms for the "Thread.CurrentLocale", which in our case was "en-IE", but SharePoint only had one locale installed which was "en-US".

To fix this behaviour, there are two possible solutions:
1) Either change the regional settings of the running application to the Farm locale (i.e. "en-US")
2) Or, download the source code of the spmmdnavigator project, and change all references of Thread.CurrentLocale to the Farm locale.

We chose the second method, for robusteness of our solution, as the tool had to be used by Power users as well.

No comments:

Post a Comment