<!–[if !mso]>
Module #03: Custom
Router Lab #03
Course: Programming Estimated Time to Complete: 30 minutes Objectives: · Operating
·
·
|
Overview: Learn
to extend the use of the Records Center!
Exercise 1 – Create A Custom Router
Purpose:
Create
a new record router to route submitted documents!
Result: A new custom router
Task 1 – Create a
Class Library
- Create a new project
- Click
File->New->Project - Select “Class Library”
- For name, type
“MyCustomRouter” - For location, type “D:Lab
Work” - Click “Ok”
- Add the following references:
- Add a reference to
Microsoft.SharePoint.dll - Add a reference to
Microsoft.Office.Policy.dll
Task 2 – Create the
router
- In your project, rename
Class1.cs to MyCustomRouter.cs - Right click, select
“Rename” - Click “yes” to rename
the class - Add the following using statements:
|
- Implement the IRouter interface:
|
- Right click the IRouter text,
select Implement Interface->Implement interface - Update the OnSubmitFile
method to the following:
|
Task 3 –Strong name
the project
- Right click the
MyCustomRouter project, select “Properties” - Click the “Signing” tab
- Click the “Sign the assembly”
checkbox - In the dropdown, select
“<new>…” - For key file name, type
“MyCustomRouter” - Uncheck the “Protect my key
file…” - Click “Ok”
- Compile the project, press F6
- Drag the D:Lab Work MyCustomRouterMyCustomRouter
inDebug MyCustomRouter.dll file to the GAC (C:windowsassembly)
Task 4 – Create a
deployment application
- Create another project
- In Visual Studio,
click File->Add->New Project - Select “Windows
Application” - For name, type
“MyCustomRouterApp” - For location, type “D:Lab
Work”
- Click “Ok”
- Add some references
- Add a reference to
Microsoft.SharePoint.dll - Add a reference to
Microsoft.Office.Policy.dll - Add a button called
“Register”, double click it - Add the following using
statements:
|
- In the button event handler,
add the following:
|
- NOTE: Be sure to replace servername and public key token!
- Set the MyCustomRouterApp to
be the startup project - Right click the
project, select “Set as startup project” - Run the application, click
the “Register” button
Task 4 – Test the
newly deployed router
- Open your Record Center Site
(http://servername:107) - Click “Record Routing”
- Edit the “Test” routing
record
- For Router, select “My
Router”
- Click “Ok”
- Open the RecordsManagementApp
project from the last lab, submit the file again! - Open your c: drive folder
and notice the new file called “Custom Submit (no url)”, your new record
router is working!