I am generating a web page in SharePoint Online with some web parts, using PnP PowerShell.
Now I am trying to set up a Highlighted Contents web part, that should display all documents in the site where the Document Type
is "My Presentation".
I have found out what the JSON for the web part should look like (using the information in Setting JSON Properties for Sharepoint Online Highlighted Content WP using PnP Powershell). But it was a lot of JSON information so I put it in a JSON file (where I also got it formatted nicely).
What would be the code to get the contents of this JSON file in the variable $myproperties
so that I can use it with Set-PnPPageWebPart
?
Add-PnPPage -Name "Test"
$page = Get-PnPPage -Identity "Test.aspx"
$MyPresWP = Add-PnPPageWebPart -Page $page -DefaultWebPartType “ContentRollup” -WebPartProperties @{layoutId=”Card”;title=”My Presentations”}
$MyPresId = $MyPresWP.InstanceId
Set-PnPPageWebPart -Page Test -Identity $MyPresId -PropertiesJson $myproperties