Forum Discussion

sp_alx's avatar
sp_alx
Copper Contributor
Apr 20, 2020

How to add a web part to a modern page programmatically in SharePoint 2019?

Hello,

 

I am looking for a way to add a web part to a modern page programmatically in SharePoint 2019 on premises.

What I want to accomplish is a custom news page, which has an additional site property "Category", which can be displayed and edited through a web part. Is seems to be possible with Pnp in SharePoint Online as described here but I can't find anything for 2019.

 

Thanks!

  • Another approach here could be to use PnP templates to get a template where you simply customize an existing page with the WebParts you want to add

Resources