Below Power Shell script help to find the list of pages with currently in checkout status with which user:
function Get-AllCheckedOutPagesByWhichUser($WebAppName)
{
$webapp = Get-SPWebApplication $WebAppName
foreach ($site in $webapp.Sites)
{
foreach ($web in $site.AllWebs)
{
#$site.url + "|" + $web.Url + "|" + $web.Url
foreach ($list in $web.lists)
{
if (($list.Title -eq "Pages") -and ($list.Items.Count -gt 0))
#if ($list.Title -eq "Pages")
{
#$list.Items.Count
$pubWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($web)
try
{
foreach($pubPage in $pubWeb.GetPublishingPages())
{
if ($pubPage.ListItem.File.CheckOutStatus -eq “LongTerm”)
{
$web.Url + "/" + $pubPage.Url + " | " + $pubPage.ListItem.File.CheckOutStatus + " | " + $pubPage.ListItem.File.CheckedOutBy.UserLogin
}
}
}
catch [System.Exception]
{
write-host $_ -ForegroundColor RED
}
}
}
}
}
}
Get-AllCheckedOutPagesByWhichUser -WebAppName "http://Webapplicationname/"
function Get-AllCheckedOutPagesByWhichUser($WebAppName)
{
$webapp = Get-SPWebApplication $WebAppName
foreach ($site in $webapp.Sites)
{
foreach ($web in $site.AllWebs)
{
#$site.url + "|" + $web.Url + "|" + $web.Url
foreach ($list in $web.lists)
{
if (($list.Title -eq "Pages") -and ($list.Items.Count -gt 0))
#if ($list.Title -eq "Pages")
{
#$list.Items.Count
$pubWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($web)
try
{
foreach($pubPage in $pubWeb.GetPublishingPages())
{
if ($pubPage.ListItem.File.CheckOutStatus -eq “LongTerm”)
{
$web.Url + "/" + $pubPage.Url + " | " + $pubPage.ListItem.File.CheckOutStatus + " | " + $pubPage.ListItem.File.CheckedOutBy.UserLogin
}
}
}
catch [System.Exception]
{
write-host $_ -ForegroundColor RED
}
}
}
}
}
}
Get-AllCheckedOutPagesByWhichUser -WebAppName "http://Webapplicationname/"
No comments:
Post a Comment