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

%3CLINGO-SUB%20id%3D%22lingo-sub-1378206%22%20slang%3D%22en-US%22%3ECreating%20a%20news%20page%20with%20powershell%20from%20a%20template%2C%20profile%20does%20not%20populate%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1378206%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20creating%20a%20news%20page%20from%20a%20template%20with%20powershell%20and%20the%20profile%20widget%20disappears.%20I%20have%20to%20edit%20the%20resulting%20page%20and%20populate%20it%20manually.%20is%20there%20some%20way%20to%20populate%20the%20profile%20from%20powershell.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHere%20is%20my%20script%3C%2FP%3E%3CP%3E%24pageName%20%3D%20%22new%20page.aspx%22%3CBR%20%2F%3E%24page%20%3D%20Get-PnPClientSidePage%20-Identity%20%22Templates%2FCompany-News%22%3CBR%20%2F%3E%24page.Save(%24pageName)%3CBR%20%2F%3E%24textWebpart%20%3D%20Get-PnPClientSideComponent%20-Page%20%24pageName%3CBR%20%2F%3E%24htmlToInject%20%3D%20'this%20is%20a%20test%20text'%3CBR%20%2F%3ESet-PnPClientSideText%20-Page%20%24pageName%20-InstanceId%20%24textWebpart.InstanceId%20-Text%20%24htmlToInject%3CBR%20%2F%3ESet-PnPClientSidePage%20-Identity%20%24pageName%20-HeaderType%20Custom%20-ServerRelativeImageUrl%20%22%2Fsites%2FHome%2FSiteAssets%2FSitePages%2FClean-Laundry-March-Update%2F200%20(1).png%22%20-TranslateX%2010.5%20-TranslateY%2011.0%3CBR%20%2F%3ESet-PnPClientSidePage%20-Identity%20%24pageName%20-PromoteAs%20%22NewsArticle%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ethanks%20for%20any%20help.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1378206%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESharePoint%20Online%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Highlighted
New Contributor

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.

0 Replies