How to Import Managed Metadata into SharePoint

  • Posted by: Softree Technology

Managed metadata is a hierarchical collection of centrally managed terms that you can define, and then use as attributes for items in SharePoint Server 2013.

You can use the Term Store management tool to create terms in a term set, or manage a term such as copy it or move it. If you have many terms that you want to add, it might be more practical to import all the terms in the term set instead of adding the terms individually. For information about how to import large volume of terms presents in comma separated value (.csv) file, please follow the below mentioned steps.

To create and manage terms in the Term Store management tool, you must be a Contributor, a Group Manager, or a Term Store Administrator.

So, please ensure you have followed all below mentioned steps one-by-one to properly upload large term sets presents in comma separated value (.csv) file in to the SharePoint Central Administration. However, a small mistake can mess everything up.

Presents below are two ways of uploading the large .csv file into the Central Administration.

By using power shell script

[code lang=”c”]

$ver = $host | select version

if($Ver.version.major -gt 1) {$Host.Runspace.ThreadOptions = “ReuseThread”}

if(!(Get-PSSnapin Microsoft.SharePoint.PowerShell -ea 0))

{

Write-Progress -Activity “Loading Modules” -Status “Loading Microsoft.SharePoint.PowerShell”

Add-PSSnapin Microsoft.SharePoint.PowerShell

}

$siteUrl=Read-Host “SiteUrl”

$filepath=Read-Host “File Path”

$usedForNavigation=$false

$groupName=Read-Host “Group Name”

$termsetname=Read-Host “Term Set Name”

##Site URL

$site = Get-SPSite $siteUrl

##CSV file

$file = get-item $filepath

$filename = $file.FullName

$session = Get-SPTaxonomySession -Site $site.Url

write-host $site.Url

$store = $session.DefaultKeywordsTermStore

#### Checking the Group name, if not present and getting the Site collection group

if($groupName -eq “”){

$group = $store.GetSiteCollectionGroup($site)

}

else{

$group = $store.Groups[$groupName]

}

if ($group -eq $null)

{

write-host “Group not found” -ForegroundColor Red

return

}

##Getting the Termset

$termset = $group.TermSets[$termsetname]

if ($termset -eq $null)

{

##Getting Import manager for the Term Store

$manager = $store.GetImportmanager()

$reader = new-object System.IO.StreamReader($filename)

$alltermsadded = $false

$errormessage = “”

write-host “Importing $filename”

$manager.ImportTermSet($group, $reader, [ref] $alltermsadded, [ref] $errormessage)

$reader.Dispose()

$termset = $group.TermSets[$termsetname]

##Checking if Site Navigation is enabled for the Term store

##One can add more custiom properties below depending upon the need

if ($usedForNavigation -eq $true)

{

$termset.SetCustomProperty(“_Sys_Nav_IsNavigationTermSet”, “True”)

$termset.SetCustomProperty(“_Sys_Nav_AttachedWeb_SiteId”, $site.ID.ToString())

$termset.SetCustomProperty(“_Sys_Nav_AttachedWeb_WebId”, $site.RootWeb.ID.ToString())

$termset.SetCustomProperty(“_Sys_Nav_AttachedWeb_OriginalUrl”, $site.RootWeb.Url)

}

if ([string]::IsNullOrEmpty($errormessage) -eq $false)

{

write-host $errormessage

}

}

$store.CommitAll()

$site.Dispose()

sleep 20

[/code]

By using Import functionality of Managed metadata service present in Central Administration

1. Go to the Central Admin

2. Under “Service Applications”, click “Manage Service Applications”

SoftreeConsulting

3. Select “Managed Metadata Service”, then click on “Manage” from ribbon

SoftreeConsulting

4. Now, you can download a sample template of managed metadata structure by clicking on “View a sample import file”

SoftreeConsulting

5. Please add all your term details in this comma separated value (.csv) file.

SoftreeConsulting

6. Once the (.csv) file is ready, then again go to the Managed metadata page (as it step 4)

7. Click on “New Group” from the context menu of “Managed Metadata”

SoftreeConsulting

8. Please provide a group name (here I have provided as “Organisation”)

SoftreeConsulting

9. Now click on “Import Term Set” and browse the file to import back to SharePoint. Now click on “Ok” button after browsing the .csv file.

Untitled6

10. Please wait while it is uploading the terms, once complete you can find all your term sets under the group “Organisation”.

managedmetadata

Hope this information will be helpful to you.

This solution is brought to you by our SharePoint professionals…

Softree Technology employs SharePoint consultants, who are experienced in writing for a multiplicity of SharePoint verticals including technical, promotional, creative, branding content, cataloguing and ethical media comprising journalism.

With more than 10 years of industry experience these professionals have the best resources to deliver optimum results. They have been satisfying customers with some of the best SharePoint Strategies.  

Author: Softree Technology

Leave a Reply