gpt4 book ai didi

sharepoint - 如何从 powershell 发布/批准 SharePoint 2010 中的页面

转载 作者:行者123 更新时间:2023-12-02 23:17:13 26 4
gpt4 key购买 nike

我有特定 SharePoint 2010 页面的列表 URL。我可以访问每个页面并单击发布按钮。然后批准按钮发布页面。

我正在尝试使该过程自动化。我想知道是否有任何方法可以从 powershell 做到这一点?

最佳答案

下面的脚本应该可以做到这一点:

$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");
}
}

关于sharepoint - 如何从 powershell 发布/批准 SharePoint 2010 中的页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21946679/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com