Expression Evaluation Time: ms / Round trip: ms
Import SharePoint Managed Metadata (Terms) with the MatchPoint Term Importer
16. Apr
2012
by Matthias Weibel Category:
Technical
4

Since SharePoint 2010 there is a feature called Managed Metadata shipped with the Server edition. It is a hiarchical collection of centrally managed terms, which can be applied to items in the SharePoint application. The hierarchical structure of the terms is organized as follows:

  1. Managed Metadata Service Application (Term Store)
  2. Group
  3. TermSet
  4. Term (Terms can have other terms as children)

Metadata Management in SharePoint

In order to administrate the metadata there is a Term Store Management Tool, where you can manually create and edit groups, term sets and terms and their properties.

If you have to deal with a lot of metadata, adding all by hand quickly becomes painful. But you can circumvent this by using the import functionality provided by the Term Store Management Tool. The import functionality allows to specify a managed metadata import file. This file is comma-separated values file (.csv) which defines the term set and the terms in the term set. A sample file of such an import file can be downloaded from the start page of the Term Store Management Tool. To carry out the import, click on Import Term Set in the context menu of an existing group in the term store and specify the import file in the opening dialog.

After the import has successfully completed the term set and terms show up below the group.

Importing metadata like this seems to work, but some limitations particularly strike out:

  • If you have a lot of data the content of the file gets confusing and the file becomes unmanageable.
  • The metadata that needs to be imported often exists already in an other application and is for example persisted in a database. That means that before you can import this data you have to export it to an importer file in the csv format.
  • Metadata is usually liable to changes: metadata gets updated, deleted and added. The metadata import functionality in SharePoint does not take this in to account. You cannot use the initial importer file, apply some changes and reimport the metadata, otherwise you pretty mess up your terms (e.g. duplicate entries).
  • In the importer file there is no option to define other labels such as synonyms or tranlations of a term, although it is possible to specify them in the Term Store Management Tool.
  • There is no possibility to schedule the import of the metadata.

The consequence of these limitations is that you have to implement a custom application which resolves these problems. Another option to eliminate these problems is to use the metadata management that comes with MatchPoint.

Metadata Management with MatchPoint

MatchPoint provides a timer job called TermImporter, which allows importing terms to the term store. This timer job can be centrally configured like the other MatchPoint components. It offers the following functionality:

  • Fully configurable through the MatchPoint Configuration Framework
  • Import of hierarchical structured terms
  • Three different import modes, which allows repeatedly running the importer and keeps the the metadata synchronized with an external system
  • Import from different data sources like SQL databases, SharePoint lists and Active Directories
  • Multilingual import of term labels and synonyms
  • Scheduling the import on minutely, hourly, daily, weekly or monthly intervals

Let me demonstrate it in short example, where I have an SQL database with two tables. One table contains countries and the other table contains cities. The cities have a relationship to the countries where they belong to. The names of the countries and cities are available in two languages, english and german.

The goal is to import the data of these two tables as terms. Terms with countries have the related city terms as children. And the labels of the imported terms are available for both languages.

You can define a TermImporterConfiguration in the Manage Timer Jobs Form of the MatchPoint Instance.

  1. In the TermImporterConfiguration specify a name and the target term store, where the terms are imported.

  2. Crate a new TermImport element.

  3. Before the required properties of the TermImport element are filled out, create a DbDataSource element below the TermImport element.
  4. In the DbDataSource element enter the connection string to the database and specify a SQL query.

  5. Back to the TermImport element set the values for the Name, the Key and the Parent attribute. The value for the Key attribute should point to a unique value for each datarow in the data source table and so we specify DataItem.ID, which means that the value from the ID column of each datarow is taken. Finally, for the value of the Parent attribute select a term set, which was previously created in the term store. The terms will be created below this term set.

  6. Define the labels for the two languages. In order to achieve this create a Labels element below the TermImport element and then add a Label element for each desired language. In the Label element select a language and for the value of the Label attribute specify the column of the datarow, that holds the value for this label, which is DataItem.NameEN for the English label and DataItem.NameDE for the German label. Additionally, synonyms of a label could be specified in the OtherLabels attribute.

  7. The next step is to define the import for the city terms, which should become child terms of the country terms. To achieve this create another TermImport element.

  8. The configuration values for this TermImport element are equivalent to the values of the TermImport element for the country terms. The significant difference is the value of the Parent attribute in the TermImport element. Here, select Use Provider Id and Key Expression and choose Countries for the Provider Id and DataItem.CountryID for the Key Expression. Like this the desired hierarchical structure of the metadata is achieved, since the parent term of the importing city term is resolved by the value of the foreign key column CountryID.

Save and close the configuration. In the Manage Timer Jobs Form the newly created TermImporterConfiguration shows up. There you can click on the Start button to execute the term import.

After the term importer has run, go to the Term Store Management Tool and verify that the terms have been imported.

The term importer can be repeatedly run on a scheduled interval. For the scheduling are different interval types available. You can add a Daily-, Hourly-, Minute-, Monthly- and WeeklyScheduleConfiguration to the TermImporterConfiguration to specify how often and when the term importer should run.
Repeatedly running the term importer updates the terms according to the changes of the data defined by the data source, so that the terms are kept synchronized with this data.

The MatchPoint Term Importer makes importing metadata more comfortable and relieves most of the limitations from the standard term import functionality that comes with SharePoint. Find out more about the taxomomy management with MatchPoint on the product website.

Comments
paro
17.05.2016 01:03
I'm trying to import tag with Matchpoint Tag Importer.
I added Static Tag importer but I dont see "Start" button on demo enviroment.
I don't see this button also for other Timer jobs provided with that demo.

Could you help me with this?

Thanks, in advance
Matthias Weibel
02.06.2016 10:03
In SharePoint least privilege environments, scheduling and executing timer jobs cannot be triggered from the GUI. But you can start the Tag Importer Timer Job with a PowerShell cmdlet "Execute-MPTimerJob", see also here in the documentation: http://www.matchpointcommunity.com/docu/mp/latest-40/Installation/PowerShell_CmdLet.html#executing-and-rescheduling-matchpoint-timerjobs
Dhanabalan
09.04.2018 12:21
Link doesn't work. Could anyone explain what does execute-MPTimerjob does
Matthias Weibel
09.04.2018 01:12
Link is updated and works now.
ABOUT

This blog is about technical and non-technical aspects of the product MatchPoint and other SharePoint topics.

If you would like to post an article or if you have an idea for a post, please contact us.

ARCHIVE
COMMENTS
Matthias Weibel
09.04.2018 01:12
Link is updated and works now. | Goto Post
Dhanabalan
09.04.2018 12:21
Link doesn't work. Could anyone explain what does... | Goto Post
matthiaszbrun
14.03.2018 02:05
Hi Markus
We I use the config for SiteCollectionSe... | Goto Post
Reto Jeger
04.10.2017 09:15
Hello Reiner,
Thanks for pointing out the missing ... | Goto Post
rganser
29.09.2017 09:56
Hi, I downloaded the ZIP-file for MatchPoint Versi... | Goto Post