1

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?

1 Answer 1

1

you should create a test page with all your web parts

then with pnp get your page as file

$toSave = $file.ListItemAllFields["CanvasContent1"]

in $toSave there is html for WebParts

put $toSave html in an text file

then add a page with Add-PnPClientSidePage

then get your page with Get-PnPClientSidePage

set property with your previoulsy save html:

$file.ListItemAllFields["CanvasContent1"] = "your html";

Update and publish your page:

[http://fdi-sharepoint.e-monsite.com][1]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.