0

I am trying to set list item permissions using powershell. The script below seems to be working fine, but granted permissions Type, in SharePoint GUI, seen as User. The one added using the GUI (or SP Workflow) however, seen as Domain Group.

enter image description here

Could you please check the the script, and help me achieve the permissions to be set as Domain Group?

foreach($item in $lib.Items){
    $account = $spWeb.EnsureUser("i:0#.f|membersprovider|claim")

    $assignment = New-Object Microsoft.SharePoint.SPRoleAssignment($account) 
    $assignment.RoleDefinitionBindings.Add($read)
    $item.BreakRoleInheritance($true)
    $item.RoleAssignments.Add($assignment)
    $item.Update()
}

1 Answer 1

0

Your claim prefix i:0#.f is telling SharePoint that this is a user ID. Try adding a group through the GUI and then selecting it to see what the claim prefix is that's been applied and use that instead.

You may see something along the lines of c:0-.f|membersprovider|s-1-5-21-1099402672-3334772329-1701100838-4393063

As you'll see from the above, group IDs are provided as SIDs, so you need to work out what these are for the groups you want to add.

1
  • Thank you very much for your answer. Although it's not entirely fixed my issue, but directed me to the solution.
    – egurb
    Commented Feb 28, 2018 at 12:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.