Have this code

function GetChildFolders($RootFolder)                       
    if($count -ne 1){                        

    if($folderName -eq $FolderRelativePath){                        

        $group = $Context.web.SiteGroups[$groupAD];                           
        $roleAssignment = New-Object microsoft.sharepoint.SPRoleAssignment($group);                        
        $roleDefinition = $Context.web.RoleDefinitions[$permission];                        

    foreach($folder in $RootFolder.Folders)                        

    GetChildFolders $folder                          


GetChildFolders $List.RootFolder                        
$count = 1                                                

This goes through all of the folders in my document library and if it matches a string (with a name of a folder in) it changes the permissions of that folder.

However I get an error saying

[Microsoft.SharePoint.Client.Folder] does not contain a method named BreakRoleInheritance.

What am I doing wrong?

1 Answer 1


Microsoft.sharepoint.client.folder does not have property for BreakRoleInheritance

Update your code with below.


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.