Forum Discussion

REllsworth's avatar
REllsworth
Copper Contributor
May 10, 2020

Creating a news page with powershell from a template, profile does not populate

I am creating a news page from a template with powershell and the profile widget disappears. I have to edit the resulting page and populate it manually. is there some way to populate the profile from powershell.

 

Here is my script

$pageName = "new page.aspx"
$page = Get-PnPClientSidePage -Identity "Templates/Company-News"
$page.Save($pageName)
$textWebpart = Get-PnPClientSideComponent -Page $pageName
$htmlToInject = 'this is a test text'
Set-PnPClientSideText -Page $pageName -InstanceId $textWebpart.InstanceId -Text $htmlToInject
Set-PnPClientSidePage -Identity $pageName -HeaderType Custom -ServerRelativeImageUrl "/sites/Home/SiteAssets/SitePages/Clean-Laundry-March-Update/200 (1).png" -TranslateX 10.5 -TranslateY 11.0
Set-PnPClientSidePage -Identity $pageName -PromoteAs "NewsArticle"

 

 

thanks for any help.

No RepliesBe the first to reply

Resources