本文讲述在SharePoint2013 中使用文档库Scheduling (计划公布功能)的步骤和注意的事项。
文档库Scheduling (计划公布功能)
用于设定当文档通过审批后特定的时间区间内才干够被普通用(非管理员,审批人员和作者)户看到。也就是说要启用Scheduling,必须先启用文档库的内容审批和小版本号控制。这是官方文档的说法,可是笔者注意到除此之外Draft
Item Security要设置成Only users who can approveitems (and the author of the item) 才行:
另外,当在系统文档库上启用Scheduling时,SharePoint会自己主动加列PublishingExpirationDate(Scheduling End Date) 和 PublishingStartDate (Scheduling Start Date)
可是当又一次新建一个文档库时,启用Scheduling时上面两列不会自己主动加入,能够有两个方法解决
1. 使用系统文档库模板
a. 将系统文档库存为模板,假设看不到另存模板的连接能够直接使用/_layouts/15/savetmpl.aspx?List=ListID能够从文档库设置中找到,或者直接把listedit.aspx换成savetmpl.aspx: /_layouts/15/listedit.aspx?List=%7B465AD054%2DD81B%2D495F%2DAA9F%2D6E44053A3B63%7D
b. 再使用a
步得到的文档库模板新建文档库,这样新建出来的文档库启用Scheduling时上面两列就会自己主动加入了
2. 启用Scheduling后从Site column
中加入这两列PublishingExpirationDate(Scheduling End Date)
和 PublishingStartDate(Scheduling Start Date)
用PowerShell的话能够这样写:
Param( [parameter(Mandatory=$true)] [alias("web")] $webUrl, [parameter(Mandatory=$true)] [alias("DocumentLib")] $documentLibTitle ) $webSite = get-SPWeb $webUrl $documentLib = $webSite.Lists[$documentLibTitle] Write-host "Enable content approval" $documentLib.EnableModeration = $true Write-host "Enable minor version" $documentLib.EnableMinorVersions = $true $documentLib.DraftVersionVisibility = 2; # Only users who can approve items (and the author of the item), lib.DraftVersionVisibility = DraftVisibilityType.Approver $documentLib.Update() [Microsoft.SharePoint.Publishing.PublishingWeb]::EnableScheduling($documentLib); # Check if the list have the two column "Scheduling Start Date" and "Scheduling End Date" ## refresh the document library $documentLib = $webSite.Lists[$documentLibTitle] if(-Not($documentLib.Fields.ContainsFieldWithStaticName("PublishingStartDate"))) { Write-host "Adding column Scheduling Start Date" $listField=$webSite.Site.RootWeb.Fields["Scheduling Start Date"] $documentLib.Fields.AddFieldAsXml($listField.SchemaXml, $true, 4) # SPAddFieldOptions.AddToAllContentTypes = 4 $documentLib.Update() } if(-Not($documentLib.Fields.ContainsFieldWithStaticName("PublishingExpirationDate"))) { Write-host "Adding column Scheduling Start Date" $listField=$webSite.Site.RootWeb.Fields["Scheduling End Date"] $documentLib.Fields.AddFieldAsXml($listField.SchemaXml, $true, 4) $documentLib.Update() } $webSite.Dispose(); Write-host "Done!" -foregroundcolor green
在SharePoint 2013 中使用文档库Scheduling (计划公布功能)