I'm trying to create custom permissions in my Sharepoint site via Powershell using the following script:
$spSite = Get-SPSite $url
$spWeb = $spSite | Get-SPWeb
foreach($option in $configuration.Config.permissions.permission)
{
if($spWeb.RoleDefinitions[$option.name] -eq $null)
{
$spRoleDefinition = New-Object Microsoft.SharePoint.SPRoleDefinition
$spRoleDefinition.Name = $option.name
$spRoleDefinition.Description = $option.description
$spRoleDefinition.BasePermissions = $option.bases
$spWeb.RoleDefinitions.Add($spRoleDefinition)
}
}
$spWeb.Dispose()
$spSite.Dispose()
And I keep receiving the following error:
Exception calling "Add" with "1" argument(s): "Collection was of a fixed size."
At C:\xxxx\xxxxxx\xxxxx:70 char:4
+ $spWeb.RoleDefinitions.Add($spRoleDefinition)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : NotSupportedException
Thanks for the help.