For the latest source code please go to the Source Code tab and download the most recent release.

Do any of these sound familiar?
  • "Writing a SharePoint Protocol Handler is way to hard!"
  • "We have no one on staff that is proficient in C++."
  • "I've found very little documentation on writing a Protocol Handler."
  • "The BDC doesn't do everything we need."

Well, then you've come to the right place. With this sample code you can write a Microsoft Office SharePoint Server 2007 Protocol Handler in managed code (C#) using the .NET framework. This is not a 'shim' or 'wrapper', it is 100% pure managed code.

Protocol Handlers are COM components (in-proc servers), traditionally written in C++. .NET allows you to create a class library and expose it as a COM component. Therefore it is possible to create a .NET COM component which will be consumed by the SharePoint search engine (Filter Daemon specifically). This sample is an instance of that approach and contains all classes and declarations necessary to build and register a Protocol Handler written in C#.

That's only the beginning. The interfaces used for a protocol handler can be confusing and tedious. I have created an abstraction class (ContentEnumerator) which insulates Protocol Handler communications from the actual work of accessing your content source by exposing simple enumeration interfaces. It should be possible to populate the 'guts' of your Protocol Handler by simply replacing the 'TODO' comments with actual calls to your data source. But if that does not meet your needs you have the freedom to modify any portion of the project - it's your project!

In addition to the source code you'll find 2 supporting documents attached:
  • MOSS Protocol Handler.docx (Word 2007 document) - note on how the sample works, with installation and troubleshooting guidance.
  • MOSS Protocol Handler.vsd (Visio 2007 diagram) - depicts the class layers and typical calling sequence.

Good luck and happy crawling!

Last edited Jul 21, 2009 at 9:18 PM by JohnKoz, version 3