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.
1 Answer
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
$rule.Update()
-
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? Commented Aug 10, 2015 at 11:42
-
-
Ideal situation is: You have some
Document libraries
in your record centre site. AndContent Organizer rule
is the one which redirects the received documents from other site collections to the destination libraries based onContent Types
. So My advice is you do not create rule for Doc Lib but for Content Types. Commented Aug 10, 2015 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 Commented Aug 10, 2015 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 Commented Aug 10, 2015 at 12:03
PowerShell
script on the server which has SharePoint?