Raquel Roses
Raquel Roses

Reputation: 3

Sharepoint 2013: How do I set a different/change term for all existing files in a document library from the term store?

I am using Managed metadata for a specific column in a document library in in Sharepoint 2013.

The term selected for this column (column name: committee) has been set to xxx from the term store but it should be yyy (also from the term store). I can set a different default term when I edit the (managed metadata) column (for instance yyy). If I then create a new folder or file it gets correctly tagged with yyy under the column committee.

How do I change/update the tag for all of the existing folders and files to the new default value xxx within this specific document library?

I need to do it in sharepoint for this document library only as both of the tems are used correctly in other document libraries.

Upvotes: 0

Views: 720

Answers (1)

Jerry_MSFT
Jerry_MSFT

Reputation: 316

The most straightforward way will be using the quick edit. You can directly change the managed metadata column value for all items with the fill handle.

enter image description here

Or you can use a PowerShell script to update all the files in the library.

Here a script I test. It works in my end.

#Variables
$WebURL="http://sp/"
$ListName="Documents"
$FieldName="TF"
 
#Get the web
$Web = Get-SPWeb $WebURL    
 
#Get the Term from Term store
$TaxonomySession = Get-SPTaxonomySession -Site $web.Site
$TermStore = $TaxonomySession.TermStores[0]
$TermGroup = $TermStore.Groups["Test Term Set Group"]
$TermSet = $TermGroup.TermSets["Task force"]
$Term = $Termset.Terms["Beta"]
 

#Get the List and List Item
$List= $Web.Lists[$listName]
$Items = $List.items
 
Foreach ( $item in $items)
{
#set managed metadata field value powershell
$MMSField = [Microsoft.SharePoint.Taxonomy.TaxonomyField]$Item.Fields[$FieldName]
$MMSField.setFieldValue($Item,$Term)
$Item.Update()
 }

Reference: https://www.sharepointdiary.com/2015/12/read-update-managed-metadata-column-values-using-powershell.html

Upvotes: 0

Related Questions