你们一定要救我。我应该进入70+ SharePoint 2013页面,并手动将每个页面html中的每个3+链接替换为正确的复制版本。与中一样,所有链接当前都指向/place1/place2/link,现在它们需要是/place3/place4/link
因此,必须有一种方法来批量编辑所有的页面,就像查找和替换一样,否则我只会坐在角落里哭上几个小时。我无法编辑文件夹结构,因为我不是项目负责人。
为了保持理智,我会不惜一切代价。
发布于 2013-02-14 08:33:44
您可以使用powershell。来自this question
function ProcessWeb($currentWeb)
{
if([Microsoft.SharePoint.Publishing.PublishingWeb]::IsPublishingWeb($currentWeb))
{
$publishingWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($currentWeb)
$publishingPages = $publishingWeb.GetPublishingPages()
foreach ($publishingPage in $publishingPages)
{
if($publishingPage.ListItem.File.CheckOutStatus -eq "None")
{
UpdatePage -page $publishingPage
}
}
Write-Host -ForegroundColor red "FINISHED"
}
else
{
Write-Host -Foregroundcolor Red "^ not a publishing site"
}
}
function UpdatePage($page)
{
$page.CheckOut();
Write-Host -Foregroundcolor green $page.Url;
$NewPageContent = $page["PublishingPageContent"].Replace("/place1/place2/link","/place3/place4/link");
$page["PublishingPageContent"] = $NewPageContent
$page.ListItem.Update();
$page.CheckIn("nothing");
$page.ListItem.File.Approve("Updated PublishingPageContent to replate place1/place2 with place3/place4");
}
ProcessWeb(Get-SPWeb -identity http://myintranet.com)
注意,你需要弄清楚一个好的replace语句是如何工作的。此外,这会自动执行可能出错的更改,因此请确保在备份生产环境中的内容数据库之前,首先在dev/uat环境中执行此操作,然后再尝试。
https://stackoverflow.com/questions/14861934
复制相似问题