0
我有一個自定義SharePoint沙盒工作流活動,我嘗試將可選參數傳遞給。然而,ULS給了我下面的異常消息:自定義沙盒工作流活動問題
類型的 「SJW.SPDActivities.SendEmailWithAttachment.SendEmailWithAttachmentActivity」 「SendEmailAttachment」 失敗。該方法包含名爲「RecipientCC」的參數,但參數字典不包含此參數的值。
我的猜測是SPUserCodeWorkflowActionWrapper正在使用某種反射來將參數綁定到我的沙盒工作流方法。但是,因爲其中的一個在我的Elements.xml文件(RecipientCC)中聲明爲可選,所以無法找到要綁定的值並因此引發異常。
任何想法如何避開這種無知的行爲?我是否必須聲明所有參數是強制性的?
我Elements.xml文件:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<WorkflowActions>
<Action Name="Send an Email with an Attachment"
SandboxedFunction="true"
Assembly="$SharePoint.Project.AssemblyFullName$"
ClassName="SJW.SPDActivities.SendEmailWithAttachment.SendEmailWithAttachmentActivity"
FunctionName="SendEmailAttachment"
AppliesTo="all"
Category="SJW Custom Actions">
<RuleDesigner Sentence="Email %1 with attachment %2">
<FieldBind Field="RecipientTo,RecipientCC,Subject,Body" Text="these people" Id="1" DesignerType="Email"/>
<FieldBind Field="AttachmentListID,AttachmentListItem" Text="file" Id="2" DesignerType="ChooseDoclibItem"/>
</RuleDesigner>
<Parameters>
<Parameter Name="__Context" Type="Microsoft.SharePoint.WorkflowActions.WorkflowContext, Microsoft.SharePoint.WorkflowActions" Direction="In" DesignerType="Hide"/>
<Parameter Name="RecipientTo" Type="System.Collections.ArrayList, mscorlib" Direction="In"/>
<Parameter Name="RecipientCC" Type="System.Collections.ArrayList, mscorlib" Direction="Optional"/>
<Parameter Name="Subject" Type="System.String, mscorlib" Direction="In"/>
<Parameter Name="Body" Type="System.String, mscorlib" Direction="In"/>
<Parameter Name="AttachmentListID" Type="System.String, mscorlib" Direction="In"/>
<Parameter Name="AttachmentListItem" Type="System.Int32, mscorlib" Direction="In"/>
</Parameters>
</Action>
</WorkflowActions>
</Elements>
我的方法聲明:
public Hashtable SendEmailAttachment(SPUserCodeWorkflowContext context,
ArrayList RecipientTo,
ArrayList RecipientCC,
string Subject,
string Body,
string AttachmentListID,
int AttachmentListItem)