My SharePoint Workflow Pet Project Update

Another day off, so another few hours to spend on cool coding stuff! In my last post I introduced you my new “pet project”: a generic SharePoint Document Library event handler that can be used for simple workflow and approval scenarios. Thanks to all the people who contacted me! Gerry posted a long reply in which he made the trade-off of developing your own workflow solution or buying a commercial product, and he would go for a commercial product. I appreciate Gerry’s opinion but let me set some things straight: it’s not my intention to compete in any way with commercial products like K2.NET, Teamplate or even BizTalk (although that would be cool ;-). They offer a lot more features, they have support and they are scalable and reliable. In the company I work for, we use Windows SharePoint Services to provide team sites to a group of people working on the same project. Sometimes there’s the need to have a very simple approval scenario, for which in my opinion the commercial solutions would be overkill and far too expensive (go talk to our management). Since we are a bunch of IT-people we can develop for each scenario a custom Event Handler implementation, which will work fine. But I just hate to create for each scenario a different Event Handler (I’m pretty quickly bored when doing repetitive work, you can ask Raf). That’s why I’ve come up with a more generic approach: a configurable Event Handler that will suit simple workflows. So will it be a better solution than the commercial ones: definitely not. Will it be as a reliable as the commercial products: probably not but I don’t intend to use it for critical processes. Will it be cheaper: I do think so since I’m developing it in my spare time (current rate €0.00 / hour, anyone want to pay more?) and configuration will be a matter of tweaking an XML file or something like that. Maybe the most important reason for me to start this project was the I’m intrigued by that kind of stuff. I want to know: can I make something like that, which problems will I have to conquer?

So, what’s the current status? Well because a video can probably say more than a 1000 words, I’ve recorded a small demo (actually I stole the recording idea from Patrick). Make sure you’ve installed Windows Media Player 9 Series and watch the video in full screen for your viewing pleasure.

So what’s going on in the video? It’s a very basic approval scenario, of course in a real life scenario the actions are executed by different people, but for simplicity the video shows only one actor. You can see how a document is submitted for review, it’s declined, submitted again and finally approved. If you watch closely you can see the Event Handler in action: sometimes there’s an additional page refresh needed to reflect the actions the Event Handler is doing in the background. Every action is triggered by setting properties (for more info see the previous post), based on the value of a property one or more actions are executed. As you can see at the end of the dem the Event Handler even can create list items that which can be used to keep an event log. I’ve decided to store the event log in an custom list (of course configurable which one, which fields etc.) and not in a field of the document, for several reasons:

  • The length of a text field of a Document Library item is limited to 255 characters (strange but true, although it seems that through the object model this limitation is not applicable).
  • You can’t set security for a specific field, so users could easily overwrite the event log. SharePoint Lists can be configured so users can only view the list for example.

At this point there are some issues for which I don’t have solution yet, maybe you can help me out:

  • I need to store the credentials (user name, password, domain) of the account that will be impersonated to do all the SharePoint actions. The easiest solution would be in the web.config file (appSettings section). But do you like having passwords sitting in plain text in a config file?
  • When you edit documents using Office 2003, you can change the value of the fields when you save the document. Of course the Event Handler will catch the insert or update event, but Office sets the status of that document to “Locked for editing” so the Event Handler can’t copy or update the document (exception: Document Locked The document you are attempting to edit is locked and cannot be updated.  It may be in use by another user or undergoing content indexing.)
    I haven’t found a solution to check in code if a document has the “Locked for editing” status. Although the real problem is that no events are raised when the status changes back to normal (when you close the document). Any thoughts?

Again your comments and feedback are greatly appreciated!


  • great ;+)


  • For your first issue (passwords in plain test). Check out aspnet_setreg.

  • Hey Jan, you're doing a great job for the community, and I'm glad that you make such solutions. From a professional point of view, I rather like more the box-products, but hey perhaps this is an opportunity for you ? Let's commercialize it as if it's a mass-consuming low entry workflow starterskit ;-))) perhaps I'll even have some potential buyers for you.

    In addition to your project name, I make the suggestion that the commercial name would be 'Pet Flow' :o

    Just a last take-away : spare-time is not free time, it's quality time for yourself, your friends and family ... it's even more expensive then a day of consulting.

    Cheers mate !

  • You just keep going, don't you? Nice work!



  • Skelta ( has recently launched a Workflow accelerator for SPS.

    Skelta integrates seamlessly with SharePoint sites maintaining the usage characteristics, look and feel of SharePoint.

    Skelta’s Process designer wizard empower non-technical workers to build and deploy document approval or review workflow within SharePoint sites.

  • how can we change the current user context

Comments have been disabled for this content.