Ok the scenario is this. I'm trying to create a Custom Workflow Activity in VS2013 that can be used in Sharepoint Designer 2010 when creating workflows. I've followed plenty of different examples but none seem to work. The custom action is showing up in SPD everytime with out fail but when trying to at them to the workflow they simply do nothing no errors anywhere.
The first attempt was done by adding an empty element and setting my in there.
The second attempt mapped a folder to the /Templates/1033/Workflow folder and putting a .actions file in there which had the in it.
Currently I'm adding the additional lines to the web.config manually normally I would be doing this with SPWebModification in an event receiver.
Everytime I'm deploying to Sharepoint, clearing the WebCahce, doing a iisreset then opening SPD
1) In VS2013 Create and Empty Sharepoint 2010 project
2) Add the references to "Microsoft.SharePoint.WorkflowActions",
"System.Workflow.Activities",
"System.Workflow.ComponentModel"
and "System.Workflow.Runtime"
3) Add new class
4) Make the class public and inherit from Activity
5) Override the Execute method
6) Add a property for the Context
7) Add a a new item that is an Empty Element (.xml)
8) Rename feature and set to Site scope
9) in the empty element add the
10) Get the Public Key Token, assembly, class name for the element file
11) Add the SafeControl and authorizedType to the web.config
12) Deploy, etc, etc.....
Class Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Workflow.ComponentModel;
using Microsoft.SharePoint.Workflow;
using Microsoft.SharePoint.WorkflowActions;
using System.Workflow.ComponentModel.Compiler;
namespace TestCWA1
{
public class TestCWA1 : Activity
{
public static DependencyProperty ClaimIDProperty = DependencyProperty.Register("ClaimID", typeof(string), typeof(TestCWA1), new PropertyMetadata(""));
[ValidationOption(System.Workflow.ComponentModel.Compiler.ValidationOption.Required)]
public string ClaimID
{
get
{
return (string)base.GetValue(TestCWA1.ClaimIDProperty);
}
set
{
base.SetValue(TestCWA1.ClaimIDProperty, value);
}
}
protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
{
return ActivityExecutionStatus.Closed;
}
}
}
Element File
<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://ift.tt/sQmbje">
<WorkflowActions>
<Action Name="Test for CWA in SPD"
ClassName="TestCWA1.TestCWA1"
Assembly="TestCWA1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7b0c1cea1fea1132"
Category="A Custom Activity"
AppliesTo="all">
<RuleDesigner Sentence="Get details from list for ID %1">
<FieldBind Field="ClaimID" DesignerType="TextArea" Id="1" Text="ID of the claim"/>
</RuleDesigner>
<Parameters>
<Parameter Name="ClaimID" Type="System.String, mscorlib" Direction="In" />
</Parameters>
</Action>
</WorkflowActions>
</Elements>
Web Config Changes
<SafeControl Assembly="TestCWA1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7b0c1cea1fea1132" Namespace="TestCWA1" TypeName="*" Safe="True" SafeAgainstScript="False" />
<authorizedType Assembly="TestCWA1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7b0c1cea1fea1132" Namespace="TestCWA1" TypeName="*" Authorized="True" />
Second Method
1) In VS2013 Create and Empty Sharepoint 2010 project
2) Add the references to "Microsoft.SharePoint.WorkflowActions",
“System.Workflow.Activities”,
“System.Workflow.ComponentModel”
and “System.Workflow.Runtime”
3) Add new class
4) Make the class public and inherit from Activity
5) Override the Execute method
6) Add a property for the Context
7) Map a folder to the /Template/1003/Workflow
8) In the mapped folder add a new item that is an XML file but with the extension .actions
9) in the .actions file add the
10) Get the Public Key Token, assembly, class name for the .actions file
11) Add the SafeControl and authorizedType to the web.config
12) Deploy, etc, etc.....
So neither of these methods produces the desired result. The custom activity appears in SPD but adding the custom activity in to the workflow doesn't work. Where am I going wrong?
I've read the article http://ift.tt/1yBUbaU
Downloaded the associated code http://ift.tt/1HTS4Zs
Built and deployed that solution the SafeControl and authorizedType are in the web.config but that does the same thing it's in SPD but won't add to the workflow. It suggests something not being setup in my environment maybe rather than a code issue.
Any help gratefully received.

0 commentaires:
Enregistrer un commentaire