Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1 task done
TheITLizard opened this issue Jan 29, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@TheITLizard
Copy link

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
@TheITLizard TheITLizard added the bug Something isn't working label Jan 29, 2025
@renewtx
Copy link

renewtx commented Feb 5, 2025

I am getting a similar error with code that was working fine until I upgraded to the latest nightly build version (2.99.125) which I had to upgrade to due to a different issue (#4550). I am using the cmdlet Get-PnPListItem like this:

$listItems = Get-PnPListItem -List $siteMasterList -Query $query -Connection $ctxSp

The connection is created using

$ctxSp = Connect-PnPOnline -Url $siteMasterUrl -ClientId $appId -Tenant $tenantId -Thumbprint $certThumbprint -ReturnConnection

which works fine I get a connection confirmed via Get-PnPContext. Again, all this was working fine before I upgraded to the latest nightly release...

It seems like this keeps happening .., you upgrade due to one issue only to encounter another issue ...

@renewtx
Copy link

renewtx commented Feb 7, 2025

Anyone have any updates or workaround ideas on this?

Thanks

@renewtx
Copy link

renewtx commented Feb 12, 2025

It looks like using 2.99.131-nightly resolves the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants