Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Add-Type -Path "C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions16ISAPIMicrosoft.SharePoint.Client.dll"
- Add-Type -Path "C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions16ISAPIMicrosoft.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()
Add Comment
Please, Sign In to add comment