0

I'm trying to add Quick Links to my SharePoint site using the PnP Module. However, when trying to run the command:

Add-PnPPageWebPart -Page $page -DefaultWebPartType "QuickLinks" -Section 2 -Column 1 

I get the error:

Add-PnPPageWebPart: Object reference not set to an instance of an object.

I tried multiple things, I even get the error when trying to run the examples from: https://pnp.github.io/powershell/cmdlets/Add-PnPPageWebPart.html

I tried creating the section manually and running examples

3
  • What are the rest of the script? The error suggest that the your variable $page don't refer to a valid page-object. Commented Nov 10, 2023 at 20:48
  • hey, my $page is: "/sites/Testhome/SitePages/Home.aspx", also tried different forms since i became desperate. Commented Nov 12, 2023 at 11:58
  • According to the documentation, you are supposed to just set the parameter to the actual page name - so "Home" should work. pnp.github.io/powershell/cmdlets/Add-PnPPageWebPart.html Commented Nov 13, 2023 at 12:51

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.