如何在没有关联表单的情况下将默认关联数据添加到 Sharepoint 工作流

How to add default association data to Sharepoint Workflow without Association Form

我想知道如何将默认关联数据添加到 Visual studio 中开发的 Sharepoint 工作流,而无需任何关联表单。

问题是我有 2 个订阅到同一工作流的不同列表,我想为每个订阅添加不同的默认参数值。

是否可以直接在Elements.xml文件中进行?

我当前的 XML 文件看起来是这样的:

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Module Name="Workflow" Url="wfsvc/c7f7e1db60fe427084c8b9f1720b613e">
    <File Url="Workflow.xaml" Type="GhostableInLibrary" Path="Workflow\Workflow.xaml" DoGUIDFixUp="TRUE">
      <Property Name="ContentType" Value="WorkflowServiceDefinition" />
      <Property Name="Libreria" Value="List1" />
      <Property Name="isReusable" Value="true" />
      <Property Name="RequiresInitiationForm" Value="False" />
      <Property Name="RequiresAssociationForm" Value="False" />
      <Property Name="WSPublishState" Value="3" />
      <Property Name="WSDisplayName" Value="Workflow" />
      <Property Name="WSDescription" Value="Description" />
      <Property Name="RestrictToType" Value="List" />
      <Property Name="RestrictToScope" Value="{$ListId:List1;}" />
      <Property Name="InitiationUrl" Value="_layouts/15/Pages/WorkflowRedirect.aspx" />
    </File>
    <File Url="WorkflowStartAssociation" Path="Workflow\WorkflowStartAssociation" Type="GhostableInLibrary">
      <Property Name="WSDisplayName" Value="Workflow" />
      <Property Name="ContentType" Value="WorkflowServiceSubscription" />
      <Property Name="WSPublishState" Value="3" />
      <Property Name="WSEventType" Value="WorkflowStart" />
      <Property Name="WSEnabled" Value="true" />
      <Property Name="WSGUID" Value="88ae7a57-4a2c-4fa5-8488-71e6f504002f" />
      <Property Name="WSEventSourceGUID" Value="{$ListId:List1;}" />
      <Property Name="Microsoft.SharePoint.ActivationProperties.ListId" Value="{$ListId:List1;}" />
      <Property Name="HistoryListId" Value="{$ListId:Lists/Workflow History;}" />
      <Property Name="StatusColumnCreated" Value="1" />
    </File>
  </Module>
  <Module Name="Workflow" Url="wfsvc/8EF78D6856824F36B1EC2014E89413B1">
    <File Url="Workflow.xaml" Type="GhostableInLibrary" Path="Workflow\Workflow.xaml" DoGUIDFixUp="TRUE">
      <Property Name="ContentType" Value="WorkflowServiceDefinition" />
      <Property Name="Libreria" Value="List2" />
      <Property Name="isReusable" Value="true" />
      <Property Name="RequiresInitiationForm" Value="False" />
      <Property Name="RequiresAssociationForm" Value="False" />
      <Property Name="WSPublishState" Value="3" />
      <Property Name="WSDisplayName" Value="Workflow" />
      <Property Name="WSDescription" Value="Description" />
      <Property Name="RestrictToType" Value="List" />
      <Property Name="RestrictToScope" Value="{$ListId:List2;}" />
      <Property Name="InitiationUrl" Value="_layouts/15/Pages/WorkflowRedirect.aspx" />
    </File>
    <File Url="WorkflowStartAssociation" Path="Workflow\WorkflowStartAssociation" Type="GhostableInLibrary">
      <Property Name="WSDisplayName" Value="Workflow" />
      <Property Name="ContentType" Value="WorkflowServiceSubscription" />
      <Property Name="WSPublishState" Value="3" />
      <Property Name="WSEventType" Value="WorkflowStart" />
      <Property Name="WSEnabled" Value="true" />
      <Property Name="WSGUID" Value="B9DAA949-99BD-46C0-9942-3D74F6CCDAD1" />
      <Property Name="WSEventSourceGUID" Value="{$ListId:List2;}" />
      <Property Name="Microsoft.SharePoint.ActivationProperties.ListId" Value="{$ListId:List2;}" />
      <Property Name="HistoryListId" Value="{$ListId:Lists/Workflow History;}" />
      <Property Name="StatusColumnCreated" Value="1" />
    </File>
  </Module>
  <ListInstance FeatureId="{2c63df2b-ceab-42c6-aeff-b3968162d4b1}"
                TemplateType="4501"
                Title="wfsvc"
                Description="This list instance is used by SharePoint to keep track of workflows. Do not modify."
                Url="wfsvc"
                RootWebOnly="FALSE" />
</Elements>

您可以在 WorkflowStartAssociation 中添加任何 属性,然后使用 GetConfigurationValue activity

在您的工作流中读取它们