I've created a custom Workflow Activity, per the instructions at http://www.wictorwilen.se/Post/Sandboxed-workflow-activities-in-SharePoint-2010.aspx.
I created my custom action, and I deployed it to my local development instance of Sharepoint 2010. I then opened a site in Sharepoint designer and saw the custom activity. I used the custom activity to build a workflow, which I attached to a custom content type on my site. I then started the workflow on an item of that content type, but I got an error.
In the Sharepoint UI, I see "Error Occurred" for the workflow status.
In the Logs, I see this: the specified solution does not exist. Here is the full error log:
02/25/2011 12:47:06.60 w3wp.exe (0x1EB8) 0x17B4 SharePoint Foundation Workflow Infrastructure 88xr Unexpected WinWF Internal Error, terminating workflow Id# 43953536-9664-4c90-bf6f-0afd40d71128 6a94b7d5-c4a3-42b0-96de-d22dd9c3da17
02/25/2011 12:47:06.60 w3wp.exe (0x1EB8) 0x17B4 SharePoint Foundation Workflow Infrastructure 98d4 Unexpected System.InvalidOperationException: Cannot execute the sandboxed code workflow action "ID352".
The specified solution "65282f1d-8cda-4617-9c4d-4bf34c8da539" does not exist.
at Microsoft.SharePoint.WorkflowActions.SPUserCodeWorkflowActivity.ExecuteUserCode()
at Microsoft.SharePoint.WorkflowActions.SPUserCodeWorkflowActivity.System.Workflow
.ComponentModel.IActivityEventListener<System.Workflow.ComponentModel
.ActivityExecutionStatusChangedEventArgs>
.OnEvent(Object sender, ActivityExecutionStatusChangedEventArgs e)
at System.Workflow.ComponentModel.ActivityExecutorDelegateInfo`1.ActivityExecutorDelegateOperation
.Run(IWorkflowCoreRuntime workflowCoreRuntime)
at System.Workflow.Runtime.Scheduler.Run() 6a94b7d5-c4a3-42b0-96de-d22dd9c3da17
The Solution ID listed is indeed the solution ID for my solution - when I right-click on the package folder in my project and click 'View Designer', that solution ID shows up in the properties window under 'Solution Id'.
And this solution is deployed farm wide - I went to Central Administration, and it shows up. If I retract from visual studio, my solution disappears from Central Admin, and if I Deploy from Visual Studio, it appears in Central Admin.
So why can't Workflow find my solution?
Here is my Elements.xml:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<WorkflowActions>
<Action
Name="Disseminate Work Folder"
Category="Analysis"
Assembly="$SharePoint.Project.AssemblyFullName$"
ClassName="Dissemination_Activity.Dissemination"
FunctionName="DisseminateWorkFolder"
AppliesTo="all"
UsesCurrentItem="true"
SandboxedFunction="true">
<RuleDesigner Sentence="Disseminate %1 to %2">
<FieldBind DesignerType="FieldNames" Id="1" Text="files" Field="FileList" />
<FieldBind DesignerType="ListNames" Id="2" Text="document library" Field="ResultsDocumentLibrary" />
</RuleDesigner>
<Parameters>
<Parameter Name="FileList" Type="System.String, mscorlib" Direction="In" DesignerType="FieldNames" Description="The list of files to disseminated" />
<Parameter Name="ResultsDocumentLibrary" Type="System.String, mscorlib" Direction="In" DesignerType="ListNames" Description="This is where the resulting zip file will be placed" />
<Parameter Name="__Context" Type="Microsoft.SharePoint.WorkflowActions.WorkflowContext, Microsoft.SharePoint.WorkflowActions" Direction="In" DesignerType="Hide" />
</Parameters>
</Action>
</WorkflowActions>
</Elements>