Forum Discussion
PapagenoSweden
Sep 11, 2018Copper Contributor
How to publish all pages in SitePages library?
I have 4 500 modern pages in my pages library and all are minor versions. I need to publish all. Does anyone have a PowerShell script for this?
- Sep 11, 2018
PnP PowerShell is the way I always find easiest for this:
Connect-PnPOnline -Url "<your site url here>"
$pageslib = Get-PnPList -Identity "Site Pages"
$pages = Get-PnPListItem -List $pageslib
foreach($page in $pages){
$page.File.Publish("Published")
}
Invoke-PnPQuery
Matt Weston
Sep 11, 2018Iron Contributor
PnP PowerShell is the way I always find easiest for this:
Connect-PnPOnline -Url "<your site url here>"
$pageslib = Get-PnPList -Identity "Site Pages"
$pages = Get-PnPListItem -List $pageslib
foreach($page in $pages){
$page.File.Publish("Published")
}
Invoke-PnPQuery
PapagenoSweden
Sep 11, 2018Copper Contributor
Exactly what I was looking for. Thanks for your quick reply.