2

I need to develop a PowerShell script to remove a group from a folder. Here's an example to illustrate my question. I have a document library named HR. In that document library, I have a folder (with unique permissions) named Benefits. A group named currEmployees has read access to the folder named Benefits. How would I remove currEmployees' access to Benefits?

I am asking how to remove a SharePoint group from a SharePoint folder. I have found examples that explain how to remove a group from a list -- but I need to remove a group from a folder within a list.

0

Try this one

$sitecol = New-Object Microsoft.SharePoint.SPSite($webURL)
$web = $sitecol.OpenWeb()
$list = $web.Lists["HR"]
$foldername="Benefits"
$folder = $list.ParentWeb.GetFolder($web.Url + "/" + $list.RootFolder.Url + "/" + $foldername)
$group = $foler.Item.RoleAssignments.Groups["currEmployees"];
$folder.Item.RoleAssignments.Remove($group)
$folder.Item.Update()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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