Contact Us
Please fill out the form below and we will get in touch within four business hours.

*Interested In:
(Check all that apply)

Synergy Corporate Technologies

 Posts ‭[1]‬

SharePoint/Nintex Workflow 2013: Extract AD Group Users, as Individual Approvers
Microsoft Shortcuts You Forgot You Forgot
Getting around Microsoft Office without a mouse – Using Key Tips
Three ways to add dummy text to Microsoft Word – and two more for fun
Creating a list in a host site using SharePoint 2013 App Part
Synergyonline > Blog > Posts > Using PowerShell to configure the drop off library and create content organizer rules
April 10

Using PowerShell to configure the drop off library and create content organizer rules

Scenario: Allowing iPads to email the drop off library in a SharePoint site so that attachments can be saved. Staff and Students would then move the content from the drop off library to a destination library in the site.


Problem: iPads create a very annoying ATT00001.htm file and we need to get rid of them.


Background: One of my clients is a private school in Australia and we have implemented a virtual classroom environment for them hosted in SharePoint. The school is also a big user of iPads for both staff and students.

The site structure is a site collection called /vc

The first level subsites are for each year code, eg /vc/year12

Within each year is a subsite for each virtual classroom. Each year can have over 150 classes. Yes we use a lot of PowerShell to script the provisioning of the virtual classroom sites.

There is a custom content type ‘School Document’ which is a child of the ‘Document’ content type. This custom content type is heavily used on many libraries in the classroom sites.


Solution: The overall solution is to use content organizer rules to move the ATT00001.htm file from the drop off library to another location. Then have an information management policy permanently delete file. Other options for deleting the file as it was created in the destination library could have been via a custom SharePoint designer workflow or a custom developed event handler. I view the workflow option as being too resource intensive. As for the event handler option I wanted to avoid the use of custom code. The following solution should work for anyone, the PowerShell is being used as I need to make the change on nearly 1000 classroom subsites.


Destination Configuration:

The following has been configured as the destination location

  1. We created a subsite at the top level of the site collection called ‘delsig’ (for delete signature). This site has been hidden from navigation and search. The permissions are also locked down as general users do not need to access it.
  2. The delsig site has the content organizer feature enabled, which creates the drop off library.
  3. A library called sigfiles was created. This will be the final destination library.
  4. Both the drop off library and sigfiles library are configured to use content types and the ‘School Document’ content type is added to both.
  5. Content organizer settings for the delsig site set to ‘Append unique characters to the end of duplicate filenames’. (Not required but gives an indication of how many files are being created)
  6. A content organizer rule has been created in the delsig site (This is to ensure that files are moved to final  library):-
    1. Rulename: sigfilemove
    2. Submission Content Type: ‘School Document’
    3. Destination: /vc/delsig/sigfiles
  7. In the library settings for the sigfiles library, modify the Information Management Policy Settings.
  8. Change the source of retention from ‘content type’ to ‘Library and Folders’.
  9. Create a retention stage based on created plus 1 day and set the action to permanently delete. This is the minimum timeframe allowed.


Central Admin Configuration:

To allow the content organizer rules to send to other subsites a send to link in central administration must first be created.

  1. A send to destination was created in central admin called MoveSigFile.
  2. The URL of destination was set to the drop off library submission URL of the delsig site.
  3. The allow manual submission checkbox was deselected so that this option would not display on the send to link next to each document in SharePoint.


Virtual Classroom Configuration

Now that we have configured the destination subsite and configured a send to link via central administration we need to configure each of virtual classroom subsites to accept files via email into the drop off library then send the unwanted files to the delsig site.

One of the problems with the content organizer feature is that it is not a site property that is easy to manipulate via PowerShell. What I ended up doing was to take one of the virtual classroom sites and configure the content organizer settings and create a content organizer rule in the browser. Once these are created I can use SharePoint manager to determine the property and the rule entry.


Content Organizer Settings

The first step is to set the content organizer settings to allow rules to send to another site. This allows the ‘MoveSigFile’ send to destination that was created in central administration to be selected as a target.


Content Organizer Rule

Next a content organizer rule was create in the test virtual classroom site via the site settings.

The content organizer rule has the following settings:

  • Name: MoveSig
  • Status: Active (5)
  • Content Type: School Document
  • Conditions: Name begins with ATT
  • Target Location: Another Content Organizer (MoveSigFile from the drop down list)


Using SharePoint Manager

SharePoint Manager can be downloaded from This tool will allow you to browse to the subsite and view the properties.

Firstly to determine how to set the property for the content organizer settings to allow other sites as a destination. I expanded the properties for the site and observed that the “_routerenablecrosssiterouting” was set to true. Now the trick here is that this property exists with the Spweb.allproperties property bag. If the property does not exist then the content organizer will just observe default behaviour. So we wil need to test if it exists, create it if it does not then set it to true. (msdn article on spweb.allproperties can be found here:

Secondly is to look at the rule. These are created in a hidden list titled “Content Organizer Rules”. Using SharePoint manager an xml output of the rule can be viewed. The tricky element is the condition string for the rule. SharePoint manager will export this as HTML entity encoded. I recommend using something like notepad++ with HTML tag plugin to HTML entity decode the string.

The encoded string looks like:

   1: <Conditions><Condition Column='8553196d-ec8d-4564-9861-3dbe931050c8|FileLeafRef|Name' Operator='BeginsWith' Value='ATT0' /></Conditions>


When decoded it will look like:

   1: <Conditions><Condition Column='8553196d-ec8d-4564-9861-3dbe931050c8|FileLeafRef|Name' Operator='BeginsWith' Value='ATT0' /></Conditions>


Go For PowerShell!

Ok now that we have determined the property that we need to set and the rules to be created we need to PowerShell this.

Firstly we need to check for the _routerenablecrosssiterouting property and set it to $true. Note in my script I’m setting $nextweb to the current subsite. This will be clear from the complete script at the end of this post.

   1: #create a string of text 'true' for use in properties
   2:           $stringtrue = [String]"True"  
   5:           #test for _routerenablecrosssiterouting property and set to True
   6:           if ($nextWeb.AllProperties.ContainsKey("_routerenablecrosssiterouting"))
   7:           {
   8:                 #_routerenablecrosssiterouting exists
   9:                 if ($nextWeb.GetProperty("_routerenablecrosssiterouting"))
  10:                       {
  11:                       #already True
  12:                       }
  13:                       else
  14:                       {
  15:                       $nextWeb.AllProperties["_routerenablecrosssiterouting"] = $stringtrue;
  16:                       $nextWeb.Update()
  17:                       }
  18:               }
  19:               else
  20:               {
  21:                   #_routerenablecrosssiterouting does not exist, create and set to true
  22:                   $nextWeb.AddProperty("_routerenablecrosssiterouting", $stringtrue)
  23:                   $nextWeb.Update()
  24:               }


Email enable drop off library

Our next step is to email enable the drop off library in this case the email address for the drop off library will be the subsite title. Therefore the full email address will be classcode AT in this example.

   1: #Email enable the drop off library
   2:            $webtitle = $nextWeb.Title.ToString()
   3:            $list = $nextWeb.Lists["Drop Off Library"]
   4:            if ($list.EmailAlias -eq $webtitle)
   5:            {
   6:            #email is already set
   7:            }
   8:            else
   9:            {
  10:            $list.EmailAlias = $webtitle
  11:            $list.Update()
  12:            }


Create the content organizer rule

This was the tricky part and is greatly helped by the xml output from SharePoint manager combined with the PowerShell method of creating an item in a SharePoint list.

   1: #create routing rule for sigfiles
   2:                #ipads will create a ATT00001.htm file which need to be moved out and deleted.
   3:                $rulelist = $nextWeb.Lists["Content Organizer Rules"]
   5:                if ($rulelist.items["MoveSig"])
   6:                {
   7:                #movesig rule already exists
   8:                }
   9:                else
  10:               {
  11:               [Microsoft.SharePoint.SPContentType]$ct = $site.RootWeb.ContentTypes["School Document"]
  12:               [Microsoft.Office.RecordsManagement.RecordsRepository.EcmDocumentRouterRule]$rule = New-Object Microsoft.Office.RecordsManagement.RecordsRepository.EcmDocumentRouterRule($nextWeb)


The Full Script

You can download the full script here. Note that I have an issue where my classroom sites had some extra feature enabled that needed to be deactivated and the content organizer reactivate to ensure a consistent state. Also this code passes in a yearcode as that is the first level subsites and then applied these settings to all classroom subsites under the first level.



Excellent Post and solves a problem for me, quick question,

When running the script i get a Exception Setting Target PAth Error, any idea why this is occuring i am using "dev/docs"
 on 11/9/2012 10:33 AM

target path error

Hi there,
sorry you are having an error.

Are you able to post up the line number or code sample of roughly where the error is occuring for you?

 on 11/19/2012 5:04 PM

Re: Using PowerShell to configure the drop off library and create content organizer rules


Thanks a lot for this excellent tutorial.

I have two issues, and I wonder if you have come across the same problems:

The following line
if ($rulelist.items["MoveSig"])
is always false, so if I run the script 3 times, I'll get 3 rules with the name "MoveSig". I guess this is not the correct way to find an existing rule.

Also you set "$rule.Aliases" to "MoveSig", which doesn't make sense. Aliases are content type aliases, not aliases for the rule.

"School Document" is your main content type for the rule, but you could use Aliases to make the rule apply for "University Document" and "Kindergarten Document" as well.
 on 12/3/2012 7:57 AM

Re: Using PowerShell to configure the drop off library and create content organizer rules

Here is one way to find out if the rule is already created:

if(($RuleList.Items | Where { $_["Title"] -eq "MoveSig" }) -ne $null)
Write-Host "Rule already created"
} else {
#Create rule
 on 12/3/2012 8:08 AM

Add Comment

Items on this list require content approval. Your submission will not appear in public views until approved by someone with proper rights. More information on content approval.


Body *




United States
55 Greens Farms Road
Westport, CT 06880
1050 Bishop St.
Suite 176
Honolulu, HI 96813
United Kingdom
Unit 13 Elder Way Waterside Drive Langley Berkshire SL3 6EP
United Kingdom
Level 37
Ocean Financial Centre
10 Collyer Quay
Singapore 049315
Asia Pacific
Level 6
115 Pitt Street
Sydney NSW 2000
+44 (0)1753 541 000
+(65) 6232 2329
+61 2 9113 7243
United States
United Kingdom
This web page conforms to W3C's "Web Content Accessibility Guidelines 1.0" Level "A" © 2015 Synergy Corporate Technologies
This site is best viewed in IE8 or above. Some features may not render properly if you are using an older browser.