- #
- Purpose of this script to reatins the permission of the Hideen Taxonomy List# List of content types and columns are are provided with csv as a input# Check
- for powershell snapin
- if ((Get - PSSnapin - Name "Microsoft.SharePoint.PowerShell" - ErrorAction SilentlyContinue) - eq $null)
- {
- Add - PsSnapin "Microsoft.SharePoint.PowerShell"
- }#
- Import csv file
- $csvFile = ".\SiteCollections.csv"
- $SiteCollections =
- import -csv - Path $csvFile - warningaction "SilentlyContinue" - Header "SiteURL"
- $Counter = 0;
- $userName = "NT AUTHORITY\authenticated users"
- $SystemAccount = "SHAREPOINT\system"
- foreach($row in $SiteCollections)
- {
- if ($Counter - gt 0)
- {
- $SiteURL = $row.
- "SiteURL"
- $SPWeb = Get - SPWeb - Identity $SiteURL
- $collRoleDefinitions = $SPWeb.RoleDefinitions;
- Write - Host - foregroundcolor "magenta"
- "Entered Site "
- $SPWeb.Title
- $Taxonomylist = $SPWeb.Lists["TaxonomyHiddenList"]
- try
- {#
- Add NT Authority group
- $user = $SPWeb.EnsureUser($userName);
- $NTGroup = $SPWeb | Get - SPUser $user
- $roleAssignmentR = new - object Microsoft.SharePoint.SPRoleAssignment($NTGroup)
- $collRoleDefinitionBindingsR = $roleAssignmentR.RoleDefinitionBindings;
- $collRoleDefinitionBindingsR.Add($collRoleDefinitions["Read"]);
- $Taxonomylist.RoleAssignments.Add($roleAssignmentR)# Add system account
- $user = $SPWeb.EnsureUser($SystemAccount);
- $SysAcc = $SPWeb | Get - SPUser $user
- $roleAssignmentR = new - object Microsoft.SharePoint.SPRoleAssignment($SysAcc)
- $collRoleDefinitionBindingsR = $roleAssignmentR.RoleDefinitionBindings;
- $collRoleDefinitionBindingsR.Add($collRoleDefinitions["Full Control"]);
- $Taxonomylist.RoleAssignments.Add($roleAssignmentR)
- }
- catch [Exception]
- {
- Write - Host - ForegroundColor Red "Failed to add permissions"
- Write - Host - ForegroundColor Red "Reason: $_.Exception.Message"
- }
- $Taxonomylist.Update();
- Write - Host "Updated permissions on TaxonomyHiddenList list." - foregroundcolor Green
- $SPWeb.Dispose();
- }
- $Counter++
- }
This code snippet for Users can not see the Terms of the Managed Metadata Columns for List Items.
For the application which I am supporting, Users started complaining that they are unable to see the terms / values for Managed Metadata Column. Only user with Full control access and site collections administrators can view the items. Reason behind this is permissions are missing for the TaxonomyHiddenList for the site collection. By default the "TaxonomyHiddenList" has unique permissions assigned as below for a Classic Mode Web-Application. Hidden list URL : http://{siteurl}/lists/taxonomyhiddenlist/allitems.aspx.
