Share via


HowTo: Create a Custom Action for an Office SharePoint Designer Workflow - Part 2

So, in my last post we went through the first steps of what we need to do to create a custom action for Office SharePoint Designer (SPD).  In Part 2, we will add the necessary .ACTION file and make a modification to our web applications web.config file to get our component successfully registered and authorized.

Creating the .ACTION file

1. Create a new text file named CreateFleetDocLib.ACTIONS and save it to:

C:\MSDNBlog\SPD\CreateFleetDocLib\CreateFleetDocLib

We are only saving this file here so it is contained in the same project. It is not compiled with the project.

2. Add the following code to the text file you just created

<?xml version="1.0" encoding="utf-8"?>
<WorkflowInfo>
<Actions Sequential="then" Parallel="and">
<Action Name="Create Fleet Document Library" ClassName="CreateFleetDocLib.FleetDocLibActivity" Assembly="CreateFleetDocLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a796aa76103ee0c2" AppliesTo="all" Category="Labs">

<RuleDesigner Sentence="Create fleet document library %1 on %2.">
<FieldBind Field="CompanyName" Text="Name of the doclib" Id="2" DesignerType="TextArea"/>
<FieldBind Field="Url" Text="Link to site" DesignerType="TextArea" Id="1"/>
</RuleDesigner>

<Parameters>
<Parameter Name="Url" Type="System.String, mscorlib" Direction="In" />
<Parameter Name="CompanyName" Type="System.String, mscorlib" Direction="In" /> </Parameters>

</Action>
</Actions>
</WorkflowInfo>

A couple of things to note here about two of the elements in this file:

<RuleDesigner> - this element represents the text you will see in the actions menu inside of the SPD wizard.

<FieldBind> - this element represents the fields that you will need to fill in in the designer once you have this action item dropped into the designer form.  The important thing here is that the 'Field' attribute value needs to be the same as a <Parameter> 'Name' attribute in the section below it.  So for example, we have a Field="CompanyName" and a Parameter Name="CompanyName".

3. Browse to the C:\Windows\Assembly directory and right click on the CreateFleetDocLib assembly and select Properties. Copy the Public Key Token to the clipboard.

4. In the CreateFleetDocLib.ACTIONS file, replace the PublicKeyToken with the Public key token you copied to the clipboard.

5. Copy the CreateFleetDocLib.ACTIONS file into the following directory:

                C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\1033\Workflow

Modifying web.config

1. Browse to the directory:

           C:\Inetpub\wwwroot\wss\VirtualDirectories\ <yourmachineanddomain>

2. Open up the web.config file for editing.

3. Add the following to the AuthorizedTypes section of the web.config file.

<authorizedType Assembly="CreateFleetDocLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a796aa76103ee0c2" Namespace="CreateFleetDocLib" TypeName="*" Authorized="True" />

4. Save the web.config file

5. Restart IIS (iisreset).