Microsoft.Office.RecordsManagement.InformationPolicy.ListPolicySettings API 提供了一种为列表设置保留策略的方法:
public void SetRetentionSchedule(string retentionXml, string description)
有GetRetentionSchedule 方法,它返回retentionXml。如何找回描述?
任何建议将不胜感激。谢谢!
Microsoft.Office.RecordsManagement.InformationPolicy.ListPolicySettings API 提供了一种为列表设置保留策略的方法:
public void SetRetentionSchedule(string retentionXml, string description)
有GetRetentionSchedule 方法,它返回retentionXml。如何找回描述?
任何建议将不胜感激。谢谢!
这是一个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('\', '/');
}
}