Last active
June 12, 2018 17:06
-
-
Save vaderj/e687a72da41b373d0b1b to your computer and use it in GitHub Desktop.
Check-in / Publish / Approve all docs in a given lib #PowerShell #SharePoint #SSOM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$web = Get-SPWeb http://demo2010a:20905 | |
$pages = "http://demo2010a:20905/Pages/TvAndRadioAlerts.aspx","http://demo2010a:20905/Pages/Systems.aspx" | |
$pages | ForEach-Object { | |
$item = $web.GetListItem($_) | |
if ($item.File.CheckOutType -ne "None") | |
{ | |
$item.File.CheckIn("Automatically checked in by Powershell", "MajorCheckIn"); | |
} | |
if ($item.Versions[0].Level -ne "Published") | |
{ | |
$item.File.Publish("Automatically published by Powershell"); | |
} | |
if ($item.ModerationInformation.Status -ne "Approved") | |
{ | |
$item.File.Approve("Automatically approved by by Powershell"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment