Skip to content

[BUG] Set-PnPFolderPermission cmdlet used with the -InheritPermissions switch returns a bad request error #4715

@TheITLizard

Description

@TheITLizard

Reporting an Issue or Missing Feature

When trying to use the cmdlet Set-PnPFolderPermission with the -InheritPermissions switch to restore inheritance to SharePoint document library folders, we are getting a non-descriptive bad request error.

Expected behavior

Previously, this command would complete successfully and set the folder to inherit permissions from the parent folder.

Actual behavior

We get the following error:

Unexpected response from the server. The content type of the response is "text/html". The status code is "BadRequest".

Running Get-PnPException returns:

Message: Unexpected response from the server. The content type of the response is "text/html". The status code is "BadRequest".

Stacktrace: at PnP.PowerShell.Commands.Base.PnPConnectedCmdlet.ProcessRecord() in D:\a\powershell\powershell\src\Commands\Base\PnPConnectedCmdlet.cs:line 103at PnP.PowerShell.Commands.PnPSharePointCmdlet.ProcessRecord() in D:\a\powershell\powershell\src\Commands\Base\PnPSharePointCmdlet.cs:line132 at System.Management.Automation.CommandProcessor.ProcessRecord()

ScriptLineNumber : 38

Steps to reproduce behavior

$folder = Get-PnPFolder -Url $subFolderURL -Includes ListItemAllFields.HasUniqueRoleAssignments, ListItemAllFields.ParentList, ListItemAllFields.ID

$folderItem = $folder.ListItemAllFields

if ($folderItem.HasUniqueRoleAssignments)
{
    $folder | Set-PnPFolderPermission -List 'Documents' -InheritPermissions
}

What is the version of the Cmdlet module you are running?

We are currently using the nightly build, version 2.99.119.

We updated to the nightly release after getting this same error with a similar cmdlet that we were using previously (Set-PnPListItemPermission) when using version 2.12.0

Which operating system/environment are you running PnP PowerShell on?

  • Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions