Script to add SPFx webpart to a classic page using PnP Powershell

Copper Contributor

I have to run a Powershell script that creates a Site Collection App catalog , then add an SPFx webpart to it and publish it. Also it has to install it in the site. I have done upto this part.

 

Last piece missing is to add it to a classic page. I can see adding to modern pages. but i need to add it to a classic page. I have seen this post - https://techcommunity.microsoft.com/t5/SharePoint-Developer/PnP-PowerShell-Adding-SPFx-web-part-to-a...

 

But it has a step to manually add SPFx app to a classic page and to get the XML. This is not possible in my case as I have to automate everything. Is there way to achieve my need or to tweak the method provided in the post.

As far my code is - 

 

Add-PnPSiteCollectionAppCatalog -Site $url
Add-PnPApp -Path D:/custom.sppkg -Scope Site -Publish
Install-PnPApp -Identity "custom-webpart" -Scope Site

 

0 Replies