0

オプションのパラメーターを渡そうとしているカスタムの SharePoint サンドボックス ワークフロー アクティビティがあります。ただし、ULS から次の例外メッセージが表示されます。

タイプ「SendEmailAttachment」の「SJW.SPDActivities.SendEmailWithAttachment.SendEmailWithAttachmentActivity」が失敗しました。メソッドには「RecipientCC」という名前のパラメーターが含まれていますが、パラメーター ディクショナリにはこのパラメーターの値が含まれていません。

私の推測では、SPUserCodeWorkflowActionWrapper は何らかのリフレクションを使用して、パラメーターをサンドボックス化されたワークフロー メソッドにバインドしていると思われます。ただし、そのうちの 1 つが 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)
4

1 に答える 1

0

Parameter ノードで InitialValue="something" を使用してみて、IIS を再起動し、ワークフローの関連付けを削除して、もう一度追加します。次に、コードで、パラメーター値が「何か」として表示された場合、パラメーター値を無視する必要があります。

于 2012-12-01T17:36:45.973 に答える