Forum Discussion

HarryM1260's avatar
HarryM1260
Copper Contributor
Oct 24, 2024

PnP SingleWebPartAppPage removing all page contents

I am trying to convert a SharePoint page into a single web part app page to display a PowerBi report in full screen. I have tried creating the page, converting to "article" layout, adding the embed (both the PBI specific and the generic embed) webpart then running the script to convert to a single webpart app page.

 

When I run the script, it is converting the page but it is removing the embedded web part. 

 

Here is my code:

$clientId = "XXX" 
$clientSecret = "XXX" 
$tenantId = "XXX" 
$scope = "https://graph.microsoft.com/.default" # Use Microsoft Graph default scope for app-only authentication


Connect-PnPOnline -Url example.com -ClientId $clientId -Tenant $tenantId -Certificatepath "C:\Users\User\Example" -CertificatePassword (ConvertTo-SecureString -AsPlainText "Example" -Force)


if(Get-PnPConnection) {
Set-PnPPage -Identity "Example.aspx" -LayoutType singleWebPartAppPage
} else {
Write-Host "Connection failed. Please check your credentials and try again."

 

 

Any help or advice would be greatly appreciated.

 

No RepliesBe the first to reply

Resources