How to create content organizer rules and configure these rules with the help of PowerShell.I have created a Record Center site collection using OFFILE#0 as template name and with the help of PowerShell with a dedicated content db.But I am not able to get the APIs used for implementing routing and content organizer rules in record center with the help of PowerShell.
1 Answer
Following is an example of simple routing rule creating in record center which routes the Content Type “Document” to the /Records/Records Library.
$mainURL = "URL"
$RecordCenterURL = "RECCENURL"
$web = New-SPWeb $RecordCenterURL -Template "OFFILE#1" -AddToTopNav
Now, here is the chunk of code to Create the Content Organizer Rule.
Write-Host -ForegroundColor White " – Creating the Supporting Documents Content Organizer Rule …" -NoNewline
[Microsoft.SharePoint.SPSite]$site = Get-SPSite $mainurl
[Microsoft.SharePoint.SPWeb]$web = Get-SPWeb $RecordCenterURL
[Microsoft.SharePoint.SPContentType]$ct = $site.RootWeb.ContentTypes["Document"]
[Microsoft.Office.RecordsManagement.RecordsRepository.EcmDocumentRouterRule]$rule = New-Object Microsoft.Office.RecordsManagement.RecordsRepository.EcmDocumentRouterRule($web)
$rule.ConditionsString = ""
$rule.CustomRouter = ""
$rule.Name = "Supporting Documents Rule"
$rule.Description = "Routes '" + $ct.Name + "' documents to the records library"
$rule.ContentTypeString = $ct.Name
$rule.RouteToExternalLocation = $false
$rule.Priority = "5"
$rule.TargetPath = "/Records/Records"
$rule.Enabled = $true
$rule.Update()
Write-Host -ForegroundColor GREEN "Done."
-
that's great.Thanks for your reply.I will use your code and test this and update here.– samolpp2Commented Apr 23, 2015 at 11:08