How Managed Metadata is stored in SharePoint Lists
I hope this post will help explain how Managed Metadata is actually stored in a list.
I’ve created a Team Site (can be any template of course) on my demo portal.
I’ve created a Managed Metadata Service in Central Admin.
I’ve wired up my demo portal Web App and my MMS Service App.
I’ve imported a Country-State-City taxonomy termset.
I’ve created a custom list (CustomListA) in my demo portal.
I’ve added a Managed Metadata field to my list and configured it to use my Country-State-City taxonomy termset.
I’ve added two items to my CustomListA. And I’ve chosen USA:Alabama:Huntsville as my item locatoin for each item.
I’ve used PowerShell to dump out my CustomListA xml.
Let’s take a look at how the data is stored. First, you can easily see the ows_Location field pointing to “12;Hunstville”. The 12 comes from the fact that Huntsville is the 12th Managed Metadata term to be used in my Site Collection. If I had only used 3 others, then Huntsville would be #4. I think you get the idea here. Note: I’m not sure why it needs to keep the 12 when another attribute contains the GUID — notice the 63371559-… after the Huntsville in ows_LocationTaxHTField0 field [Line 7]. But it is what it is.
After looking over the CustomListA XML file, I then used PowerShell to render my TaxonomyHiddenList. This list is what ties all other lists in it’s site collection to the Managed Metadata Service or TermStore. If you scroll down to line 656, you’ll see ows_IdForTerm=63371559… This is the same value in Line 7 of the CustomListA xml file. This GUID is our link.
For what it’s worth, here are the powershell scripts used to create these XML files. First, the script to create out custom list xml file.
Second, the script to create our TaxonomyHiddenList xml file.
Tags: Managed Metadata Service