I am dynamically creating sites (Modern sites/pages) and I want to add
embed webpart with embedded code each time a site gets created.
How can I do that with PnP Powershell script?
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.Sign up to join this community
you should create a test page with all your web parts
then with pnp get your page as file
$toSave = $file.ListItemAllFields["CanvasContent1"]
$toSave there is html for WebParts
$toSave html in an text file
then add a page with
then get your page with
set property with your previoulsy save html:
$file.ListItemAllFields["CanvasContent1"] = "your html";
Update and publish your page:
<a href="http://fdi-sharepoint.e-monsite.com">my site</a>