如何获取 SharePoint 工作流中的参数

发布于 2024-07-04 21:03:49 字数 1149 浏览 5 评论 0原文

我正在尝试创建一个带有输出参数的自定义工作流程操作以进行错误处理。 根据各种示例,我无法让 Parameter Direction="Out" 工作。 一切似乎都正确,但当我尝试将输出分配给 SharePoint Designer 中的“错误”变量时,它会在其周围放置星号并将其标记为工作流错误。 操作 XML 如下所示:

<Action Name="Create Folder"
  ClassName="ActivityLibrary.CreateFolderActivityTest"
  Assembly="ActivityLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxxx"
  AppliesTo="all"
  CreatesInList="ListId"
  Category="Custom">
  <RuleDesigner Sentence="Create a folder %1 in the %2 base folder. If an error occurs it will be output to %3.">
    <FieldBind Field="FolderName" Text="folder name" Id="1"  />
    <FieldBind Field="BaseFolderPath"  Text="folder path" Id="2"/>
    <FieldBind Field="OutError" DesignerType="ParameterNames" Text="out error" Id="3"/>
  </RuleDesigner>
  <Parameters>
    <Parameter Name="FolderName" Type="System.String, mscorlib" Direction="In" />
    <Parameter Name="BaseFolderPath" Type="System.String, mscorlib" Direction="In" />
    <Parameter Name="OutError" Type="System.String, mscorlib" Direction="Out" />
  </Parameters>
</Action>

I'm trying to create a custom workflow action with an output parameter for error handling. Working from various examples, I can't get Parameter Direction="Out" to work. Everything seems right, but when I try to assign the output to the "error" variable in SharePoint Designer, it places asterisks around it and flags it as a workflow error. Here is what the action XML looks like:

<Action Name="Create Folder"
  ClassName="ActivityLibrary.CreateFolderActivityTest"
  Assembly="ActivityLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxxx"
  AppliesTo="all"
  CreatesInList="ListId"
  Category="Custom">
  <RuleDesigner Sentence="Create a folder %1 in the %2 base folder. If an error occurs it will be output to %3.">
    <FieldBind Field="FolderName" Text="folder name" Id="1"  />
    <FieldBind Field="BaseFolderPath"  Text="folder path" Id="2"/>
    <FieldBind Field="OutError" DesignerType="ParameterNames" Text="out error" Id="3"/>
  </RuleDesigner>
  <Parameters>
    <Parameter Name="FolderName" Type="System.String, mscorlib" Direction="In" />
    <Parameter Name="BaseFolderPath" Type="System.String, mscorlib" Direction="In" />
    <Parameter Name="OutError" Type="System.String, mscorlib" Direction="Out" />
  </Parameters>
</Action>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

榕城若虚 2024-07-11 21:03:49

你对此有什么进展吗? 我怀疑问题更有可能出现在您的逻辑代码中,而不是这个 xml (.actions) 文件中。 我看起来完全可以接受。

Did you get anywhere with this? I suspect the problem was more likely in your logic code rather than this xml (.actions) file. It looks perfectly acceptable to me.

月光色 2024-07-11 21:03:49

您确定问题出在参数上,而不是 SPD 中的变量吗? 当然,您的 XML 看起来没有任何问题。

我一直讨厌 SPD 和工作流程让您在工作流程中创建一个变量,并在页面中创建另一个变量以分配与工作流程变量相同的值。

Are you sure the issue is with the parameters and not maybe the variable in SPD? Certainly nothing looks wrong with your XML.

I always hated the way SPD and workflows make you create a variable within the workflow and another within the page to assign to the same value as the workflow variable.

天邊彩虹 2024-07-11 21:03:49

我认为从绑定的外观来看,您可能需要 Direction="InOut"

I think you may want Direction="InOut" from the looks of the binding

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文