1

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.

Thanks.

1

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
$webURL="https://xxx.sharepoint.com/sites/test"
$UserName= "test@xxx.onmicrosoft.com"
$Password = "***"
$listName="customlist"
$fieldName="TestMM"

$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)

$ctx.Load($field)
$ctx.ExecuteQuery()
#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"')
$field.Update()
$ctx.ExecuteQuery()

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.