Paul Galvin's (old) SharePoint space [SharePoint

Just another site

SharePoint Designer — Custom activity to execute user-defined C# functions


UPDATE: This has been released to CodePlex here:

UPDATE: See here for latest release notes:!1CC1EDB3DAA9B8AA!381.entry

UPDATE: See here for my thoughts on commercializing this project:!1CC1EDB3DAA9B8AA!569.entry

This project provides a custom activity in SharePoint Designer.  Use this custom activity to invoke (dispatch) any C# function that you incorporated into the linked assembly.

As of late October, 2007, this is just an initial version of the project.  I plan to expand it with a number of additional functions, including substring, index, replace, invoking web services and anything that seems useful or interesting.  I also plan to post this to codeplex once I have my act together on that front.  This will also be deployable as a solution at some point.

If you have any comments, questions or suggestions, please leave them in comments or email me.


I make absolutely no claims as to the suitability of this for any purpose.  Use at your own risk.

Installation steps (to be followed for each WFE in the farm):

1. Download the .zip and extract.

2. Install the .dll into the GAC.  I usually open c:\windows\assembly using windows explorer and copy it there.

3. Modify web.config to add the assembly to the safe controls:


<authorizedType Assembly="SpdGenericInterface, Version=, Culture=neutral, PublicKeyToken=abe076fd8125f3c4" Namespace="Nivlag" TypeName="*" Authorized="True" />

4. Copy "SpdGenericInterface.actions" to C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\1033\Workflow

Note that the above location is specific to english language installations.

5. Close SharePoint Designer (if it’s already open).

6. iisreset

7. Open SPD and create a new workflow.

If all goes well, you should be rewarded with a new category of action:



See here ( for a terrific overview of the process for creating, installing and configuring a solution like this.

The .zip is designed to extract directly to you c:\ drive.  If you do this, you can open the project and all the paths will be consistent.

To use this in visual studio, you probably need to install "Extensions for Windows WF".

The initial upload contains just one "dispatcher function", "ToLower()".  To add more functionality, add it to the Execute method as shown:

        protected override ActivityExecutionStatus
          Execute(ActivityExecutionContext executionContext)

            string functionToDispatch;
            functionToDispatch = this.DispatchFunction.ToLower();

            switch (functionToDispatch)
                case "tolower()":
                        this.OutResult1 = this.InParam1.ToLower();

                        this.OutResult1 = "Unknown function: [" + this.DispatchFunction + "].";

            return ActivityExecutionStatus.Closed;
        } // ActivityExecutionStatus


Then, re-build the project and copy the assembly to the GAC.  I expect an iisreset would be required.


7 responses to “SharePoint Designer — Custom activity to execute user-defined C# functions

  1. R November 3, 2007 at 11:28 pm

    Paul this sounds like a great idea!

  2. Mike November 3, 2007 at 11:34 pm

    Definitely sounds like a good idea. I\’d love to get involved in the usage and testing of the functions. It\’s true that the string functions are limited in SPD, but the "Dynamic String Builder" is pretty powerful.<a href="">-Monjo </a>

  3. Marco May 6, 2008 at 4:24 am

    it sounds good, but I can\’t install the extension =(my Designer con see it but when i click on it nothing appear… please help… tnx.

  4. Marco June 20, 2008 at 4:49 am

    hi all,
    can anyone explain which web.config file i have to modify? please answer soon.

  5. Gerry August 26, 2008 at 1:00 am

    I followed his directions and everything seemed to work until I choose the action in SP Designer.  The designer did not paste the code in the workflow.  I sent this guy an email and I guess he is too busy to respond. 
    I solved the problem myself.
    Past the actions from "SpdGenericInterface.actions" into the "WSS.actions" file and it everything worked.  I hope this helps others.

  6. Ashish September 30, 2008 at 4:10 pm

    Thanks for Nice COntrol, it solves my lot of problems

  7. Christian November 25, 2008 at 3:32 am

    Hi Gavin,
    this is just cool!
    I\’ve done something similar: PowerActivity.
    Bye, Christian

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: