pnpcore: [BUG] Get-PnPGroupPermissions: Object reference not set to an instance of an object.

Reporting an Issue

Get-PnPGroupPermissions raises “Object reference not set to an instance of an object” exception when using existing group title as Identity.

Expected behavior

Expecting to get permissions for a group identified by its title.

Actual behavior

Command raises a NullReferenceException when specifying a group name (existing or not). Notice that no exception occurs when passing a group object or its Id… and of course no results either.

Steps to reproduce behavior

Connect-PnPOnline -Url $url -Credentials $credentials
$group = Get-PnPGroup -AssociatedOwnerGroup
Get-PnPGroupPermissions -Identity $group.Title

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

PnP.PowerShell version 1.3.19-nightly (same with 1.2.6-nightly)

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

  • [x ] Windows
  • Linux
  • MacOS
  • Azure Cloud Shell
  • Azure Functions
  • Other : please specify

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 32 (16 by maintainers)

Commits related to this issue

Most upvoted comments

Issue has been resolved

@jansenbe Tried with v1.5.32-nightly, and the cmdlets “Set-pnpgrouppermissions” and “Get-pnpgrouppersmission” seem to work flawless now. Get-PnPPage -Identity h still throws the error “Object reference not set to an instance of an object.”, but this might be normal as I don’t know the expected output of this command.

2021-05-03_11h29_53

So when using PS7 (.NET Core) this works…when using PS5 (.NET Framework) it fails…seems that there’s a different encoding going on in .NET causing the problem. At least we’re one step further now 😃

I tried it again using v1.5.29-nightly, same issue. I sent the fiddler export a few minutes ago to your email address. This is an export for the 2 commands we have problems with (Get-PnPGroupPersmission, Get-PnPPage).

@rom-1 : would it be possible to start Fiddler, then start PS and provide me a trace of the Get-PnPGroup and Get-PnPGroupPermissions calls. Feel free to send to bjansen@microsoft.com. This will help diagnose, the issue I’ve fixed today seems to be different.

Also give Get-PnPPage -Identity h a try on your site, should not error out.

Might potentially also be linked with issue pnp/pnpcore#407