As i'm in sharepoint 2010 and in sandbox solution, i can't use taxonomy field. I've created a new term store and i'd like import them in in the list TaxonomyHiddenList

Like this, i'll be abble to do a camlquery, retrieve the item with id and if i set my item with this, it'll work

item["taxonomy"] = itTaxonomy.id+";#"+itTaxonomy["Term"]

thans for your help


i did a powershell script. it works but MS are not agree to modify this list

    Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

$url=Read-Host "Site Url"
$siteCollection = Get-SPSite $url
$web = Get-SPWeb($url)
$termSet = Get-SPTaxonomySession -Site $url
$termStore = $termSet.TermStores["Remote UnPartitionned Metadata Service Application"]
#récupère le term set du groupe Categories
$termGroup = $termStore.Groups["Taxonomie MLOZ"]

$termStoreId = $termGroup.Id

$listTaxo = $web.Lists["TaxonomyHiddenList"]

foreach ($termGroups in $termGroup.TermSets)
    $termSetId = $termGroups.Id
    foreach ($term in $termGroups.GetAllTerms()) 
        #getNode $termSets
        $i = 0
        $parent = ""
        $termParent = $term.Parent
        while($i -le 6)

            if($termParent.Id -ne $null)
                $parent += $termParent.Name.Replace([System.Text.Encoding]::UTF8.GetString($amp), "&")+":"
            $termParent = $termParent.Parent
        $test = $parent.split(",")
        $parent = $test -join ','

        $parent += $term.Name.Replace([System.Text.Encoding]::UTF8.GetString($amp), "&")

        $newItem = $listTaxo.Items.Add()
        $newItem["Title"] = $term.Name.Replace([System.Text.Encoding]::UTF8.GetString($amp), "&")
        $newItem["IdForTermStore"] = $termStoreId
        $newItem["IdForTerm"] = $term.id
        $newItem["IdForTermSet"] = $termSetId
        $newItem["Term"] = $term.Name.Replace([System.Text.Encoding]::UTF8.GetString($amp), "&")
        $newItem["Path"] = $parent
        $newItem["Term1033"] = $term.Name.Replace([System.Text.Encoding]::UTF8.GetString($amp), "&")
        $newItem["Path1033"] = $parent

        #Update the object so it gets saved to the list

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.