I have written a custom workflow activity in Visual Studio 2012. I have deployed the dll and allowedtypes.xml etc etc and it is showing up when I look in Sharepoint Designer to add an action. I can add it to the workflow and interact with it just fine, setting the variables, but when I go to publish any workflow with that action in it, I get the error below. I do not know what to be looking for from here. How can I proceed, or what should I try looking for?
Microsoft.Workflow.Client.ActivityValidationException: Workflow XAML failed validation due to the following errors:
Cannot create unknown type '{clr-namespace:testCustomWorkflowAction;assembly=testCustomWorkflowAction}testActionCode'. HTTP headers received from the server - ActivityId: fa97008a-ebd8-4953-b285-4518eed5853f. NodeId: XXXX-XXXXXXXX. Scope: /SharePoint/default/d83c404d-b1b9-4e4c-ba22-72000556ca18/5acdea96-83f7-4403-8b0a-a4b8824e15ff. Client ActivityId : b41f169d-cdeb-50dc-3698-00c71
My actions4 file:
<?xml version="1.0" encoding="utf-8"?>
<WorkflowInfo Language="en-us">
<Actions>
<Action Name="TestAddUsertoGroup"
ClassName="testCustomWorkflowAction.testActionCode"
Assembly="testCustomWorkflowAction, Version=1.0.0.0, Culture=neutral, PublicKeyToken=106c0bc3254af6c0"
AppliesTo="all"
Category="Core Actions">
<RuleDesigner Sentence="Adds user: %1 to group: %3 on site: %2">
<FieldBind Field="User" Text="User ID" Id="1" DesignerType="Integer" DisplayName="UserID" />
<FieldBind Field="Site" Text="Site URL" Id="2" DesignerType="StringBuilder" DisplayName="SiteURL" />
<FieldBind Field="Group" Text="Group Name" Id="3" DesignerType="StringBuilder" DisplayName="GroupName" />
</RuleDesigner>
<Parameters>
<Parameter Name="User" Type="System.Int32, mscorlib" Direction="In" DesignerType="Integer"
Description="Param var" />
<Parameter Name="Site" Type="System.String, mscorlib" Direction="In" DesignerType="StringBuilder"
Description="Param var" />
<Parameter Name="Group" Type="System.String, mscorlib" Direction="In" DesignerType="StringBuilder"
Description="Param var" />
</Parameters>
</Action>
</Actions>
</WorkflowInfo>
My AllowedTypes.xml file:
<?xml version="1.0" encoding="utf-8" ?>
<AllowedTypes>
<Assembly Name="testCustomWorkflowAction, Version=1.0.0.0, Culture=neutral, PublicKeyToken=106c0bc3254af6c0">
<Namespace Name="testCustomWorkflowAction">
<Type>testCustomWorkflowAction</Type>
</Namespace>
</Assembly>
</AllowedTypes>
My CS file:
[BuildActivity(HostEnvironmentOption.All)]
class testActionCode : CodeActivity
{
// Define an activity input argument of type string
[RequiredArgument]
public InArgument<int> User { get; set; }//%1
[RequiredArgument]
public InArgument<string> Site { get; set; }//%2
[RequiredArgument]
public InArgument<string> Group { get; set; }//%2
protected override void Execute(CodeActivityContext context)
{
// Obtain the runtime value of the Text input argument
int user = context.GetValue(this.User);
string siteUrl = context.GetValue(this.Site);
string group = context.GetValue(this.Group);
try
{
using (SPSite site = new SPSite(siteUrl))
{
using (SPWeb web = site.OpenWeb())
{
SPGroup mySpGroup;
web.AllowUnsafeUpdates = true;
mySpGroup = web.SiteGroups[group];
SPUser mySPUSER = web.AllUsers.GetByID(user);
mySpGroup.AddUser(mySPUSER);
mySpGroup.Update();
web.Update();
}
}
}
catch (Exception ex)
{
}
}
}