2012-05-31 26 views
2

Microsoft.Office.RecordsManagement.InformationPolicy.ListPolicySettings API提供了設置保留策略列表的方法:如何獲得SharePoint列表保留策略描述

public void SetRetentionSchedule(string retentionXml, string description) 

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

任何建議,將不勝感激。謝謝!

+0

如果有人尋找答案麗莎得到這個MSDN上: http://social.msdn.microsoft.com /論壇/ NL-BE/sharepointgeneralprevious /線程/ 3a7323f6-a3fd-4E2B-9c67-27a1fc18c1c4 – bizon

回答

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('\', '/'); 
    } 
}