I have created a taxonomy type site column using PowerShell Script. I need to enable "Allow multiple values" property using script.
I have searched a lot. In some solutions it says it's possible while adding the column to the list. But I need that property set while creating the site column itself.
Below is the code which I used to create the site column.
$fieldAsXML = "<Field Type='$($column.FieldType)'
DisplayName='$($column.DisplayName)'
Name='$($column.name)'
Group='$($column.group)'
Required='$($column.required)'/>"
#see tips below for info about fieldOptions
$fieldOption = [Microsoft.SharePoint.Client.AddFieldOptions]::AddFieldInternalNameHint
$field = $fields.AddFieldAsXML($fieldAsXML, $true, $fieldOption)
$context.load($field)
Any help is appreciated.
Thanks.
Update:
For Taxonomy I used, Lee_MSFT's answer.
For Lookup I used, the below method:
$fieldAsXML = "<Field Type='LookupMulti'
DisplayName='$($column.DisplayName)'
Name='$($column.name)'
Group='$($column.group)'
Mult='TRUE'
Required='$($column.required)'
List='$($column.List)'
ShowField='$($column.ShowField)'/>"
For Taxonomy, we can also use Field Type='TaxonomyFieldTypeMulti' and Mult='TRUE' properties.
I would suggest you use Add-PnPTaxonomyField.
Connect-PNPOnline -Url https://domain.sharepoint.com/sites/Developer
Add-PnPTaxonomyField -List "MyDoc4" -DisplayName "Testa" -InternalName "Testa" -MultiValue -TermSetPath "Test|Global"