IRouter Interface for Custom Routers
When a file is submitted to the records center, Microsoft Office SharePoint Server 2007 calls the appropriate custom router, if there is one, using the OnSubmitFile method. The router then performs its operation on the submitted document and associated metadata. The custom router processes the submitted file and its associated metadata. This process is opaque to Microsoft Office SharePoint Server 2007. When the custom router is finished, it returns one of three results to the records center:
The router has successfully finished, and the records center continues with its standard processing and storage of the submitted file.
The router has successfully finished, but the records center cancels its standard processing and storage of the submitted file.
The router has failed; the records center discontinues its standard processing and storage of the submitted file, and returns an error to the calling application.
In each case, the router can also return additional information about the routing. In the last two results, the records center returns this information to the calling application as well.
Custom Processing of Submitted Documents
Several of the parameters of the OnSubmitFile method are passed by reference, enabling the custom router to change these values if necessary. These include the fileToSubmit, properties, destination, and resultData parameters. Because of this, the custom router has the ability to do the following:
Edit the submitted document. Suppose a developer wants to store the actual submitted file in a different location. The developer can program the router to store the file elsewhere, and replace the submitted file in the fileToSubmit parameter with a text file containing a URL to the actual file storage location.
Edit the submitted document metadata. For example, the custom router can parse the submitted document to extract additional metadata, and then write that metadata to the properties parameter.
Change the storage destination of the submitted document. For example, the custom router can parse the submitted document, and update the destination of the document based on information in the document.
Communicate detailed information about its processing results. The custom router can write any detailed processing information necessary to the resultData parameter. If the router fails, or if the router informs the records center to cancel its own processing of the submitted document, the records center returns this information to the calling application.
Canceling the Processing of Submitted Documents
The router can return a value of SuccessCancelFurtherProcessing, which informs the records center that the router has successfully completed its processing, but that the records center should not perform its own processing. In this case, the records center halts its processing, and the submitted document and its associated metadata are not stored in the repository. Developers can use this functionality to implement a solution in which the router performs all the processing and storage of documents of a certain record routing type that is submitted to a records center.
In cases where the router instructs the records center to cancel file processing, the records center returns a success value to the calling application, but also returns the contents of the resultDetails parameter. Developers can use this parameter to communicate detailed information about the router processing to the calling application.