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

New Contributor

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!

1 Reply
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