如果使用Sharepoint Designer 2007在Sharepoint列表中创建定制的工作流,会发现它是一个强大的工具。使用内嵌的工作流设计器,不写一行代码就可以创建一个还可以的工作流。使用这个工具可以简单的就像在Outlook中创建一个规则一样创建一个工作流。

在Sharepoint Designer 2007中有很多自带的工作流的动作,可以创建、修改列表,发送邮件,创建栏等等。但是如果想做其它的一些操作,怎么办呢? 比如和后台通讯,或者是执行一些高度定制的操作,怎么办呢?

那么你可以扩展Sharepoint Designer 2007, 你可以在设计器中直接引用你定制的动作。开发人员可以关注于建立一个工作流动作的库,业务分析员或管理员可以专注于在更高的层次上来使用它完成实际的工作。

WSS.ACTIONS
完成这个工作主要依靠Sharepoint Server中的一个文件WSS.ACTIONS,这个文件在目录12TEMPLATE33Workflow(中文是2052) 下。当在Sharepoint Designer中打开或者创建一个工作流的时候,都会首先打开并读取这个文件中的配置信息。这个文件声明了一些可以使用的工作流,以及展现规则,条件,特殊动作等详细信息。通过修改这个文件,可以在Sharepoint Designer中展现不同的工作流、动作。

在Sharepoint Designer中加入一个简单的动作的步骤如下:
1、 创建一个定制的动作
2、 签名、把这个dll加载到GAC中
3、 配置Sharepoint使他识别这个定制的动作
4、 建立一个.ACTIONS文件给Sharepoint Designer使用

创建一个定制的动作:
这个例子就是演示在系统日志中写入一条信息

在Sharepoint Designer 2007 中加入定制的工作流动作using System;
在Sharepoint Designer 2007 中加入定制的工作流动作
using System.ComponentModel;
在Sharepoint Designer 2007 中加入定制的工作流动作
using System.ComponentModel.Design;
在Sharepoint Designer 2007 中加入定制的工作流动作
using System.Collections;
在Sharepoint Designer 2007 中加入定制的工作流动作
using System.Diagnostics;
在Sharepoint Designer 2007 中加入定制的工作流动作
using System.Drawing;
在Sharepoint Designer 2007 中加入定制的工作流动作
using System.Workflow.ComponentModel.Compiler;
在Sharepoint Designer 2007 中加入定制的工作流动作
using System.Workflow.ComponentModel.Serialization;
在Sharepoint Designer 2007 中加入定制的工作流动作
using System.Workflow.ComponentModel;
在Sharepoint Designer 2007 中加入定制的工作流动作
using System.Workflow.ComponentModel.Design;
在Sharepoint Designer 2007 中加入定制的工作流动作
using System.Workflow.Runtime;
在Sharepoint Designer 2007 中加入定制的工作流动作
using System.Workflow.Activities;
在Sharepoint Designer 2007 中加入定制的工作流动作
using System.Workflow.Activities.Rules;
在Sharepoint Designer 2007 中加入定制的工作流动作
在Sharepoint Designer 2007 中加入定制的工作流动作
在Sharepoint Designer 2007 中加入定制的工作流动作
namespace MyCustomActivity

这个例子中的Message我们可以在Sharepoint中给它赋值

注册这个动作
首先给这个库加入签名(在解决方案的工程上右键-)属性-〉签名),在把它复制到GAC中(类似于配置一个WebParts)
在Sharepoint网站的Web.config中加入如下节点:
<authorizedType Assembly="JohnHolliday.Workflow.EventLoggerActivity, Version=1.0.0.0,
      Culture=neutral, PublicKeyToken=0b97b340d4a71524"
      Namespace="MyCustomActivity" TypeName="*" Authorized="True" />

创建.ACTIONS文件
最后的步骤就是创建一个.ACTIONS文件。这是一个XML文件,你可以使用VS2005或其它XML编辑器。
以下是一个.ACTIONS文件的示例
<?xml version="1.0" encoding="utf-8" ?>
<WorkflowInfo>
<Actions Sequential="then" Parallel="and">
   <Action Name="Write Message To Event Log"
      ClassName="JohnHolliday.Workflow.EventLogger"
 Assembly="JohnHolliday.Workflow.EventLoggerActivity, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0b97b340d4a71524"
      AppliesTo="all" Category="MyCustomActivities">
   <RuleDesigner Sentence="Write '%1' to the event log">
      <FieldBind Field="Message" DesignerType="TextArea" Id="1"/>
   </RuleDesigner>
   <Parameters>
      <Parameter Name="Message" Type="System.String, mscorlib" Direction="In"/>
   </Parameters>
</Action>
</Actions>
</WorkflowInfo>
(每一个节点的意思我就不翻译了在Sharepoint Designer 2007 中加入定制的工作流动作,可以去查看原文,其实很简单,猜一下应该就知道了)
然后把这个文件复制到服务器(可以直接在WSS.ACTIONS中加入),再打开Sharepoint Designer的工作流设计窗口,就可以如下看到这个动作了:
在Sharepoint Designer 2007 中加入定制的工作流动作

[an error occurred while processing this directive]

相关文章:

  • 2022-12-23
  • 2021-09-13
  • 2022-01-29
  • 2021-09-08
  • 2022-12-23
  • 2021-09-13
  • 2021-07-27
猜你喜欢
  • 2021-04-03
  • 2022-03-02
  • 2022-12-23
  • 2022-12-23
  • 2021-10-08
  • 2022-12-23
相关资源
相似解决方案