Forum Discussion
Using Type Script to create a modern page?
- Nov 13, 2018
Hi,
Just FYI, PnP JS-Core is deprecated in favor of the new PnPJs libraries.
You can find exactly what you're trying to do (create pages and add components) here:
https://pnp.github.io/pnpjs/sp/docs/client-side-pages/
Hi, Jayakumar and thanks for your reply.
I was a bit unclear in my question, sorry.
What I mean is I need to create the page programmatically, add some information (basically a text webpart) and then save the page, thus rendering a new page in the Site Pages library.
In C# you can use AddClientSidePage, call AddControl to add webparts and finally call Save. This is all PnP stuff. I'm looking for something equivalent for TypeScript.
Ok, I got it. A bit embarrassing, but still...
I can of course use the same PnP approach in TypeScript as in C#. I just need to be aware of the async-await concept. This is how you do it:
- Thomas BermanNov 13, 2018Iron Contributor
Hi,
Just FYI, PnP JS-Core is deprecated in favor of the new PnPJs libraries.
You can find exactly what you're trying to do (create pages and add components) here:
https://pnp.github.io/pnpjs/sp/docs/client-side-pages/