I have a bunch of doc libraries. I need to create content organizer rules for these 2000 libraries through powershell? Any help will be appreciated. I also have to fill the condition string.

  • Will you be running this PowerShell script on the server which has SharePoint? – Asad Refai Aug 10 '15 at 11:33
  • Yes the server has sharepoint 2010 installed.... – Pinak satra Aug 10 '15 at 11:35

You can PowerShell script to create a content organizer rule. It uses Microsoft.Office.RecordsManagement.RecordsRepository.EcmDocumentRouterRule

[Microsoft.SharePoint.SPSite]$site = Get-SPSite http://www.mycompany.com
[Microsoft.SharePoint.SPWeb]$web = Get-SPWeb http://www.mycompany.com
[Microsoft.SharePoint.SPContentType]$ct = $site.RootWeb.ContentTypes["MyContentType"]
[Microsoft.Office.RecordsManagement.RecordsRepository.EcmDocumentRouterRule]$rule = New-Object Microsoft.Office.RecordsManagement.RecordsRepository.EcmDocumentRouterRule($web)

$rule.Aliases = $ct.Name
$rule.ConditionsString = "<conditions></conditions>"
$rule.CustomRouter = ""
$rule.Name = $ct.Name
$rule.Description = "Routes '" + $ct.Name + "' documents to it's own library"
$rule.ContentTypeString = $ct.Name
$rule.RouteToExternalLocation = $false
$rule.Priority = "5"
$rule.TargetPath = $web.Lists["MyLibrary"].RootFolder.ServerRelativeUrl
$rule.Enabled = $true
| improve this answer | |
  • I have the list of Doc libraries in a csv file for each of them i need to create a seperate org rule.how do i accomodate this? – Pinak satra Aug 10 '15 at 11:42
  • Are those doc libraries in your Record Centre site? – Asad Refai Aug 10 '15 at 11:44
  • Ideal situation is: You have some Document libraries in your record centre site. And Content Organizer rule is the one which redirects the received documents from other site collections to the destination libraries based on Content Types. So My advice is you do not create rule for Doc Lib but for Content Types. – Asad Refai Aug 10 '15 at 11:47
  • yes... my url is something like this : myurl/rec/subsite/"the 2000 library names 1 by 1"/subfolder/subfolder. This is where the documents should route. That means i need to create 2000 diff org rules for each of these libraries – Pinak satra Aug 10 '15 at 11:49
  • i want the library names to be dynamic from a csv as i want this powershell to run 2000 times for the 2000 diff library names – Pinak satra Aug 10 '15 at 12:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.