2

Microsoft.Office.RecordsManagement.InformationPolicy.ListPolicySettings API 提供了一种为列表设置保留策略的方法:

public void SetRetentionSchedule(string retentionXml, string description)

有GetRetentionSchedule 方法,它返回retentionXml。如何找回描述?

任何建议将不胜感激。谢谢!

4

1 回答 1

1

这应该可以解决您的问题: http ://social.technet.microsoft.com/Forums/en-CA/sharepointgeneralprevious/thread/3a7323f6-a3fd-4e2b-9c67-27a1fc18c1c4

这是一个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('\', '/');
    }
}
于 2012-12-30T20:19:49.443 回答