Recently I was working on upgrading a custom router from SharePoint 2007 to 2010. This blog points out some of the deprecated methods and provides details on the new methods replacing it.
In SharePoint 2007, IRouter interface provided the definition for the method OnSubmitFile. The OnSubmitFile allows users to process and route documents that are uploaded to a content organizer enabled site. In SharePoint 2010 IRouter interface is replaced by the ICustomRouter interface. The method signature OnSubmitFile method has changed in SharePoint 2010.
Method Signature in SharePoint 2007
ref byte fileToSubmit,
ref RecordsRepositoryProperty properties,
ref SPList destination,
ref string resultDetails)
Method Signature in SharePoint 2010
Application Modernization Industry Quick Guides
Application modernization enables you to optimize business processes and transform the way you do business today, and in the future. Our industry experts have collected the latest application modernization trends impacting the automotive, financial services, healthcare, and manufacturing verticals.
ref string resultDetails)
The file input is in the form of a file stream instead of a byte array. The destination parameter a SPFolder object is passed instead of a SPList object used in SharePoint 2007. The SharePoint 2010 also requires EcmDocumentRoutingWeb for specifying the web instead of the sourceURL parameter passed as a string. EcmDocumentRoutingWeb is a new class introduced in SharePoint 2010 for managing web sites that enable a single point for document submission.
The return type for the OnSubmitFile method in SharePoint 2007 was an enumeration called RouterResult. This has been replaced in SharePoint 2010 by CustomRouterResult. CustomRouterResult contains two elements, SuccessContinueProcessing and SuccessCancelFurtherProcessing.
SuccessContinueProcessing indicates that the file was processed sucessfully and content organizer should continue processing the file. SuccessCancelFurtherProcessing indicates that the file was processed successfully and terminates any further processing. This option is particularly helpful when the custom router moves the file to a required document library and does not require any further processing by other content organizer rules. It does not contain the RejectFile element that was part of RouterResult.
There are also a few changes to classes involved in registering routers to the site.
The AddRouter method used for loading Routers in SharePoint 2007 has been deprecated. AddCustomRouter method contained in EcmDocumentRoutingWeb class is used for loading the router to a content organizer enabled site.
EcmDocumentRoutingWeb oRoutingWeb= new EcmDocumentRoutingWeb(oWeb);
oRoutingWeb.AddCustomRouter(“Router Name”, “routerName, assemblyName, “className”);
While SharePoint 2007 allows routers to be added only to record centers, SharePoint 2010 allows adding routers to any content organizer enabled site
An example for a custom router can be found in MSDN