2014-02-21 2 views
9

특정 SharePoint 2010 페이지에 대한 목록 URL이 있습니다. 각 페이지를 방문하여 게시 버튼을 클릭 할 수 있습니다. 그런 다음 버튼을 승인하여 페이지를 게시하십시오.powershell에서 SharePoint 2010의 페이지를 게시/승인하는 방법

저는 프로세스를 자동화하려고합니다. 파워 쉘에서 그렇게 할 수있는 방법이 있는지 궁금합니다.

+0

를? 어떤 유형의 사이트를 사용하고 있습니까? – beavel

답변

14

스크립트를 넣고 그것을 수행해야이 문제를 해결하기 위해 시작했다 무엇

$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"); 
    } 
} 
관련 문제