Pnp-powershell: [BUG] Add-PnPClientSideWebPart: Object reference not set to an instance of an object

Created on 28 Sep 2020  路  3Comments  路  Source: pnp/PnP-PowerShell

Expected Behavior

Add-PnPClientSideWebPart -Page $page -DefaultWebPartType "List" -Section 1 -Column 1 -Order 1

Add-PnPClientSideWebPart -Page $page -DefaultWebPartType "List" -Section 1 -Column 1 -WebPartProperties @{isDocumentLibrary="false";selectedListId="55e6a7eb-6e15-4fb5-bebd-2e8bb4cd60ae";selectedViewId="47e6a7eb-6e15-4fb5-bebd-4e7bb2cd60rt";webpartHeightKey=4}

The above 2 commands will create "List" Client-Side Web Part to a modern Page
The above command was working till last week 25/Sep/2020 Friday without any issues.
Can someone please provide light on this. Please.

Actual Behavior
Getting below error
Add-PnPClientSideWebPart : Value cannot be null.
Parameter name: Passed control cannot be null
At D:\SPO\CreateModernPage.ps1:71 char:5

  • Add-PnPClientSideWebPart -Page $page -DefaultWebPartType "List" - ...
  • ~~~~~~~~~~~~~

    • CategoryInfo : WriteError: (:) [Add-PnPClientSideWebPart], ArgumentNullException

    • FullyQualifiedErrorId : EXCEPTION,PnP.PowerShell.Commands.WebParts.AddClientSideWebPart

Add-PnPClientSideWebPart: Object reference not set to an instance of an object.
At D:\SPO\CreateModernPage.ps1:76 char:5

  • Add-PnPClientSideWebPart -Page $page -DefaultWebPartType "List" - ...
  • ~~~~~~~~~~~~~

    • CategoryInfo : WriteError: (:) [Add-PnPClientSideWebPart], NullReferenceException

    • FullyQualifiedErrorId : EXCEPTION,PnP.PowerShell.Commands.WebParts.AddClientSideWebPart

Steps to reproduce behavior

$SiteURL = "https://testtenant.sharepoint.com/sites/Test1"
$connOpen = Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)
$pagename = "HomeTest6"

$page = Add-PnPClientSidePage -Name $pagename -LayoutType Home -Publish
Add-PnPClientSidePageSection -Page $page -SectionTemplate OneColumn -Order 2

Add-PnPClientSideWebPart -Page $page -DefaultWebPartType "List" -Section 1 -Column 1 -Order 1
$page.Save()
$page.Publish()

Add-PnPClientSideWebPart -Page $page -DefaultWebPartType "List" -Section 1 -Column 1 -WebPartProperties @{isDocumentLibrary="false";selectedListId="55e6a7eb-6e15-4fb5-bebd-2e8bb4cd60ae";selectedListUrl="/sites/Test1/Lists/testlist";webRelativeListUrl="/Lists/testlist";webpartHeightKey=4}

$page.Save()
$page.Publish()

Please help on this

bug

Most helpful comment

The root cause of the problem has been found and a fix is rolling out soon.

All 3 comments

Client Web Part Issue

The root cause of the problem has been found and a fix is rolling out soon.

Think we can close, there's many independent confirmations the issue is fixed

Was this page helpful?
0 / 5 - 0 ratings