powerShell赋权限
1.给网站赋权限
Set-SPUser –Identity “用户名” –AddPermissionLevel “参与讨论” –web “http://url”
2.给列表赋权限
$web = Get-SPWeb http://url
$account = $web.EnsureUser("用户名")
$role = $web.RoleDefinitions["参与讨论"]
$list = $web.Lists["thxtest"]
$list.BreakRoleInheritance($true)
$assignment = New-Object Microsoft.SharePoint.SPRoleAssignment($account)
$assignment.RoleDefinitionBindings.Add($role)
$list.RoleAssignments.Add($assignment)
$list.Update() $web.Dispose()