Deploying Custom Activity for SharePoint Designer

Hey guys,

In my last post I show you how to create a custom activity now I want to show you how can deploy a custom activity.

 

The first step is to register the built assembly in GAC with gacutil.

Then we have to configure the settings for SPD. The first step is to create a *.ACTIONS file in the 12 hives folder. So navigate to:

 

C:\Program Files\Common Files\microsoft shared\web server extension\12\Template\language Id\Workflow

 

In this folder is already a file named WSS.ACTIONS I prefer to create a new *:ACTIONS File for the custom Activities. So create one and copy the code below there:

 

<WorkflowInfo>

  <Actions Sequential="then" Parallel="and">

            <Action Name="Your Custom Action"

  ClassName="YourNamespace.YourCustomActivity"

  Assembly="YourCustomAssemblyName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0298457208daed83"

  AppliesTo="all"

  Category="Custom Actions">

      <RuleDesigner Sentence="Copy item in %1 to list at %2, existing items.">

        <FieldBind Field="Message" Text="value" Id="1" DesignerType="TextArea" />

      </RuleDesigner>

      <Parameters>

        <Parameter Name="Message" Type="System.String, mscorlib" Direction="In"  />

      </Parameters>

    </Action>

  </Actions>

</WorkflowInfo> 

 

So now we have a look at the definition of this config file.

 

WorkflowInfo:

This is the root element for a *.ACTIONS File, this must be included in every Actions File

 

-          Attributes:

o    Language – refers to the language of the server. It must be in form language/culture pair

 

Actions Element:

The Actions Element describes the set of Actions which are defined in the config file. The Sequential and Parralel values are used to identify what the

SPD should be write if this Action is not the first one. So if you have multiple languages set up then you have to create 2 Actions file in each language folder one.

And you have to specify the sequential value e.g. in english and german.

 

Action Element:

-          Name – The name which should be displayed in SPD for use

-          ClassName – The class Name of the current Activity

-          Assembly – The .NET Assembly which includes the Activities

-          Category (optional) – Provides a new category in SPD

-          CreateTask(optional) – If set to true then a task list item will be created

-          ListModeration(optional) – If set to true this action element applies to a list or

doc library that has content approval enabled

 

Rule Designer Element:

This element contains information about how to render a workflow sentence in SPD.

 

Attributes:

-          Sentence – the sentence which describes the Activity and used to bind the parameters to the Workflow

 

Field Bind Element:

This is one of the important elements in the config file. It describes How a parameter should be bind in SPD.

           

-          DesignerType  - specifies the type of control which will be shown in SPD

o    This can have a child element named Option

§  Name – The display name of the option for a drop down list

§  Value – The value for the current item

-          Field – specify the parameter name of the workflow

-          Id – The identifier for the field, this will be used to map the field in the sentence

-          Text – The text which will be shown in the sentence instead of the placeholder

 

The most interesting attribute is the Designer Type attribute. Which Designer Type is when accessible shows this table:

 

 

Value

Data Bound

Default Builder

Show DropDown

Advanced Builder

Control Description

Boolean

x

o

x

o

Drop down box with true and false choice

ChooseDocLibItem

o

o

o

x

Document library selector

ChooseListItem

o

o

o

x

Default

CreateListItem

o

o

o

x

Default

Date

x

x

o

o

Date/Time selector

Dropdown

o

o

x

o

DropDown list. Static items can be populated by adding Option elements

Email

o

o

o

x

Email advanced control

FieldNames

o

o

x

o

Drop Down List with all field names of the current list

Float

x

o

o

o

Textbox

Hyperlink

x

x

o

o

URL browser

Integer

x

o

o

o

TextBox

ListNames

o

o

x

o

DropDown List with all Lists of the WebSite

Operator

o

o

x

o

DropDown List with operators which will be filled static in the Option Element

ParameterNames

o

o

x

o

DropDown List with all local variables which has been defined for the current workflow

Person

x

x

o

o

Person or Group selector

SinglePerson

x

x

o

o

Person or Group selector

Stringbuilder

o

o

o

x

Inline text box editor

Survey

o

o

o

x

Default

Text

x

o

o

o

Default

Textarea

x

x

o

o

Default

UpdateListItem

o

o

o

x

Default

writablefieldNames

o

o

x

o

DropDown List populated with a list of fields or a list of doc librariers

 

 

Parameters:

Container for all Parameter elements and contains no definable attributes. The Parameters element is a complex element type

and can be used with both Actions and Conditions elements to define their parameters.

Parameter

-          Type – The Type of the parameter e.g. System.String

-          Direction – defines whether the parameter will be used as in- or output. Valid values are ‘In’ and ‘Out’

-          Name – the identifier for the parameter

-          InitialValues – optional used to define which default value should be send with this parameter

 

 

After you have finished the creating of an *.ACTIONS File you have to register the CustomActivity assembly in the portal as authorized type.

So navigate to web.config file of the portal e.g. C:\Inetpub\wwwroot\wss\80\web.config

 

Open it and search for ‘authorizedTypes’

 

Add a new authorized Type for your assembly as following and save the web.config file.

 

<authorizedType Assembly="SampleActivity, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9e176eda06c49b19" Namespace="Test.SampleActivity" TypeName="*" Authorized="True" />

If you don't want to do it manually here you can find an automatic script build with PowerShell.  

 

Restart IIS in some cases a restart of the whole system is required.

So that’s it. Now you can open your SPD and try to insert your custom activity.


Posted Aug 04 2008, 11:44 AM by Nadine Storandt

Comments

nut wrote re: Deploying Custom Activity for SharePoint Designer
on 01-14-2009 0:11

Thank you for post

I have question regarding Attribute Type of Parameter element.

Is it possible to use own custom type? or Type is only System type?

asnm105 wrote re: Deploying Custom Activity for SharePoint Designer
on 05-05-2010 20:21

Thank you so much for your post, I couldn't find a list of the various designertypes until I came across yours.

developers.de is a .Net Community Blog powered by daenet GmbH.