I need to create a subfolder (in a SharePoint document library) without inheriting permissions from the parent folder. I then need to assign specific permissions to the newly created subfolder. What is the best way to go about doing this? Thank you.
I used PowerShell to create Folder A inside a SharePoint 2013 document library. I used PowerShell to create a subfolder of FolderA. This subfolder is named FolderB. I do not want FolderB to inherit any of FolderA's permissions. However, when I create FolderB, FolderB inherits all of FolderA's permissions. Is there a way to tell SharePoint not to apply FolderA's permission to FolderB when FolderB is created? Here is my code:
$FolderA = $list.AddItem("", [Microsoft.SharePoint.SPFileSystemObjectType]::Folder, "Folder A"); $FolderA.Update(); $FolderA.BreakRoleInheritance("true"); $FolderA.Update(); Write-Output "Folder created " $FolderA.Url $FolderBURL=$list.ParentWebUrl +"/" + $FolderA.Url; write-host $FolderBURL; $FolderB = $list.AddItem($FolderBURL, [Microsoft.SharePoint.SPFileSystemObjectType]::Folder, "Folder B"); $FolderB.Update(); $FolderB.BreakRoleInheritance("true"); $FolderB.Update();
Thanks in advance.