Update taxonomy

21/03/2012 09:44

After term name change in termstore, taxonomy field value is changed in edit mode, but not in view mode. Original value is still displayed. It's because of value in TaxonomyHiddenList

#Update taxonomy hidden list - update termstore values after term rename

#input parameter
$siteUrl="https://td_sp_dev3/gbp/portal"


$Assem = (
    "Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" ,
    "Microsoft.SharePoint.Taxonomy, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
         )
           
$Source = @"

using Microsoft.SharePoint;
using Microsoft.SharePoint.Taxonomy;
using System;
 

namespace TaxonomyUpdater
{
    public static class TaxonomyHiddenList
    {
        public static void Update(string SiteUrl)
        {
            SPSite Site2Update = new SPSite(SiteUrl);
            TaxonomySession.SyncHiddenList(Site2Update);
            Site2Update.Dispose();
        }
    }
}
"@
Add-Type -ReferencedAssemblies $Assem -TypeDefinition $Source -Language CSharp
[TaxonomyUpdater.TaxonomyHiddenList]::Update($siteUrl)