| Create a Custom Worflow Activity with Visual Studio Part 1 |
| Step | Description | |
| 1 | In visual studio 2010, add a new project to your solution. | |
| 2 | Choose Empty SharePoint 2010 Project | |
| 3 | Configure the SharePoint Server | |
| 4a | Add a SharePoint Mapped Folder to your solution | |
| 4b | Browse to TEMPLATE/Workflow | |
| 5a | Add a new item to the mapped folder | |
| 5b | Select XML file and name it tztools.ACTIONS | |
| 5c | Add information based on your activity<?xml version="1.0" encoding="utf-8" ?>
<WorkflowInfo>
<Actions Sequential="then" Parallel="and">
<Action Name="RegEx evaluation"
ClassName="tztools.tzRegEx"
Assembly="tztools, Version=1.0.0.0, Culture=neutral, PublicKeyToken=887d18a96eeddf51"
AppliesTo="List" Category="TzTools">
<RuleDesigner Sentence="Parse %1 using %2 and set result in %3">
<FieldBind Field="xListItemField" Text="field" Id="1" DesignerType="WritableFieldNames" />
<FieldBind Field="xRegEx" Text="Regular Expression" Id="2" DesignerType="" />
<FieldBind Field="xResult" Text="Parsing Result" Id="3" DesignerType="ParameterNames" />
</RuleDesigner>
<Parameters>
<Parameter Name="__Context" Type="Microsoft.SharePoint.WorkflowActions.WorkflowContext, Microsoft.SharePoint.WorkflowActions" Direction="In" DesignerType="Hide" />
<Parameter Name="__ListId" Type="System.String, mscorlib" Direction="In" DesignerType="Hide" />
<Parameter Name="__ListItem" Type="System.Int32, mscorlib" Direction="In" DesignerType="Hide" />
<Parameter Name="xListItemField" Type="System.String, mscorlib" Direction="In" DesignerType="WritableFieldNames" Description="Field to get the value of" />
<Parameter Name="xResult" Type="System.String, mscorlib" Direction="Out" />
<Parameter Name="xRegEx" Type="System.String, mscorlib" Direction="In" />
</Parameters>
</Action>
</Actions>
</WorkflowInfo> | |
| 6a | Add en event receiver to your feature | |
| 6b | Add the following code : (in the using section using Microsoft.SharePoint.Administration; public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
SPWebApplication webapp = (SPWebApplication)properties.Feature.Parent;
SPWebConfigModification modAuthorizedType = new SPWebConfigModification();
modAuthorizedType.Name = "AuthType";
modAuthorizedType.Owner = "tztools";
modAuthorizedType.Path = "configuration/System.Workflow.ComponentModel.WorkflowCompiler/authorizedTypes";
modAuthorizedType.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode;
modAuthorizedType.Value = " | |
| 7a | Now we want to add the tztools to our package. Dubble click on package.package | |
| 7b | Click on Advanced | |
| 7c | From the new form,select Add -> Add Assembly from project output | |
| 7d | Add the output dll from the tztools project | |
| 8 | Build and deploy, your activity is now available in SharePoint Designer |












No comments:
Post a Comment