I am looking for a way to change a managed metadata column from single entry to multiple entry using Powershell. Any help would be appreciated. Using SharePoint Online.



The PowerShell below for your reference:

Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"

#set parameters
$UserName= "test@xxx.onmicrosoft.com"
$Password = "***"

$credentials= New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName,(ConvertTo-SecureString $Password -AsPlainText -Force))
$ctx= New-Object Microsoft.SharePoint.Client.ClientContext($webURL)
$ctx.Credentials = $credentials
$oList = $ctx.Web.Lists.GetByTitle($listName)
$field = $oList.Fields.GetByTitle($fieldName)

#Remove the node if it exists, and add again
$fieldXml = $field.SchemaXml.Replace('Mult="FALSE"', '')
$field.SchemaXml = $fieldXml.Replace('Type="TaxonomyFieldType"', 'Type="TaxonomyFieldTypeMulti" Mult="TRUE" Sortable="FALSE"')

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.