When users can’t access a taxonomy

129

When users cannot access a MMS taxonomy

The Managed Metadata Service is great; but what do you do when users can’t view some taxonomy entries? This occurs when the user does not have access to the HiddenTaxonomyList, native to each Site Collection.

You can view the list using SharePoint Manager from CodePlex, navigating the Object Model, or simply by modifying this URL to reflect your site collection URL:
http ://SharePoint/sites/SiteCollection/Lists/TaxonomyHiddenList/AllItems.aspx where “http ://SharePoint/sites/SiteCollection” is replaced with your site collection URL.

I recently found a situation where permissions by default were empty. Best would be to allocate all Authenticated users access. However what does one do if there are many site collections within a given Web Application? Here’s a script that will iterate through Site Collections, and grant the access:


$WebApp = "http ://SharePoint" #replace with your own web app
$webapp = get-spwebapplication $webapp

function AddPerm ([Microsoft.SharePoint.SPList] $TargetObj, [string] $RoleValue, [string] $RoleGroup)
{ #SPWeb is implied and not passed as parms for efficiency!
	if ((!$RoleValue) -or (!$RoleGroup))
	{
	return; #race to be efficient on NullOp
	}
	try
	{
				$user = $SPWeb.ensureuser($RoleGroup)
				$roledef = $SPWeb.RoleDefinitions[$RoleValue]
				$roleass = New-Object Microsoft.SharePoint.SPRoleAssignment($user)
				$roleass.RoleDefinitionBindings.Add($roledef)

				$TargetObj.RoleAssignments.Add($roleass)  
	}
	catch
	{
	Write-Host -ForegroundColor DarkRed "ERR: Can't Assign $($RoleGroup)"
	}
}

for ($i=0; $i -lt $WebApp.Sites.Count; $i++)
{
	$site=$webapp.Sites[$i];
	$SPWeb=$site.rootweb;
	$list = $SPWeb.Lists["TaxonomyHiddenList"]
	addPerm $list "Read" "SharePoint NT Authenticated Users"
}

Share this entry

Leave a Reply

Your email address will not be published. Required fields are marked *

Table of Contents

Categories

Categories