Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Updating managed metadata column settings via powershell

$
0
0

Hi,

My client want to change some settings of one managed metadata column.

1. change to allow multiple values.

2. To allow fill-in for users.

It's required that it's changed in every sitecollection.

Any advice how to iterate trough every sitecollection in webapplication?

here's my script so far, not working... You are free to comment anything in script, I'm quite noob in powershell.

Add-PSSnapin Microsoft.Sharepoint.Powershell
[Microsoft.SharePoint.SPSecurity]::RunWithElevatedPrivileges({
$webApplicationURL = "http://sharepointwebapp/"
$webApp = Get-SPWebApplication $webApplicationURL

$termStore = $session.TermStores[$serviceApp.Name] 

$termSet = $termStore.Groups["My library"].TermSets["Computers"]

if($webApp -ne $null)
{
  Write-Host "Web Application : " + $webApp.Name

  foreach($siteColl in $webApp.Sites)
    {
     if($siteColl -ne $null)
      {
         Write-Host "Site Collection : " + $siteColl.Url
         foreach($web in $siteColl.AllWebs)
          {
            if($web -ne $null)
              {
 $web = $site.RootWeb  
 $taxonomyField = $web.Fields | Where { $_.Id -eq "99e8cfdc-3edb-4d0e-b22e-0bde0cfe8dfd" }  
 $taxonomyField.SspId = $termSet.TermStore.Id  
 $taxonomyField.TermSetId = $termSet.Id  
 $taxonomyField.AllowMultipleValues = $true
 $taxonomyField.FillInChoice = $true
 $taxonomyField.Update();  
              }
           else
              {
                Echo $web "does not exist"
              }
          }
            $siteColl.Dispose()
       }
     else
         {
            Echo $siteColl "does not exist"
         }
     }
} else
     {       Echo $webApplicationURL "does not exist, check the WebApplication name"
     }Remove-PsSnapin Microsoft.SharePoint.PowerShell
Echo Finish
});


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>