Microsoft.Office.RecordsManagement.InformationPolicy.ListPolicySettings API提供了一种为列表设置保留策略的方法:
public void SetRetentionSchedule(string retentionXml, string description)
有GetRetentionSchedule方法,它返回retentionXml。如何取回说明?
任何建议都将不胜感激。谢谢!
答案 0 :(得分:1)
这是一个powershell版本:
function Get-RetentionScheduleDescriptionForFolder() {
[CmdletBinding()]
param (
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[Microsoft.SharePoint.SPList]$List
)
$policyFile = $List.ParentWeb.GetFile(( Join-Uri list.RootFolder.Url "Forms/RetentionPolicy.Xml"));
if ($null -ne $policyFile) {
[xml]$xml = (New-Object System.Text.UTF8Encoding).GetString($policyFile.OpenBinary());
$xml.RetentionItems.a.Desc;
}
}
function Join-Uri () {
[CmdletBinding()]
param (
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$Path,
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$ChildPath )
$scheme = (([System.Uri]$Path).Scheme)+'://'
if($scheme -ne '://') {
$joinedPath = Join-Path -Path $Path.Replace($scheme, '') -ChildPath $ChildPath
$scheme+($joinedPath.Replace('\', '/'));
} else {
$joinedPath = Join-Path -Path $Path -ChildPath $ChildPath
$joinedPath.Replace('\', '/');
}
}