Guest User

Untitled

a guest
Dec 18th, 2017
382
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. Add-Type -Path "C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions16ISAPIMicrosoft.SharePoint.Client.dll"
  2. Add-Type -Path "C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions16ISAPIMicrosoft.SharePoint.Client.Runtime.dll"
  3.  
  4. #set parameters
  5. $webURL="https://xxx.sharepoint.com/sites/test"
  6. $UserName= "test@xxx.onmicrosoft.com"
  7. $Password = "***"
  8. $listName="customlist"
  9. $fieldName="TestMM"
  10.  
  11. $credentials= New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName,(ConvertTo-SecureString $Password -AsPlainText -Force))
  12. $ctx= New-Object Microsoft.SharePoint.Client.ClientContext($webURL)
  13. $ctx.Credentials = $credentials
  14. $oList = $ctx.Web.Lists.GetByTitle($listName)
  15. $field = $oList.Fields.GetByTitle($fieldName)
  16.  
  17. $ctx.Load($field)
  18. $ctx.ExecuteQuery()
  19. #Remove the node if it exists, and add again
  20. $fieldXml = $field.SchemaXml.Replace('Mult="FALSE"', '')
  21. $field.SchemaXml = $fieldXml.Replace('Type="TaxonomyFieldType"', 'Type="TaxonomyFieldTypeMulti" Mult="TRUE" Sortable="FALSE"')
  22. $field.Update()
  23. $ctx.ExecuteQuery()
Add Comment
Please, Sign In to add comment