说实话,AdobeWorkFlow的API写的太一般了,基本没有什么可以直接就可以运行的例子。
大量的代码都是用ASP的VBS脚本完成的。对于这样一个帮助文档,只能让我去猜,它实现了什么功能。
总结了一下,显示当前所有WorkFlow中用户的唯一标识是一个很有用的功能,因为,在以后的工作任务处理过程中,经常要使用这个ID。
但WorkFlow的API只提供了功能实在太弱的方法为程序开发人员使用。
我原来用VB写了个例子,要以做为一个参考。
Option Explicit
![](/Images/OutliningIndicators/None.gif)
Dim g_connObj As EPSDK.Connection
Dim g_connStr As String
Dim g_userName As String
Dim g_password As String
Dim g_dsnName As String
Dim g_server As String
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
Private Sub cmdInitializeConnect_Click()Sub cmdInitializeConnect_Click()
![](/Images/OutliningIndicators/InBlock.gif)
Set g_connObj = New EPSDK.Connection
Dim connStr
' connStr = "DSN=" & g_dsnName & ";SERVER=" & g_server & ";UID=" & g_userName & ";PWD=" & g_password
connStr = "DSN=Adobe Workflow Server"
' Open connection
g_connObj.Open (connStr)
Debug.Print "Initialize connection succeful"
End Sub
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
Private Sub cmdListUsers_Click()Sub cmdListUsers_Click()
If g_connObj Is Nothing Then
MsgBox ("Please connect to server first")
Exit Sub
End If
Dim rs As EPSDK.Recordset
Set rs = New EPSDK.Recordset
Dim strSql As String
strSql = "select DisplayName, userID from users"
Set rs = g_connObj.Execute(strSql)
If rs.EOF Then
MsgBox "There are not any user"
Exit Sub
End If
Dim i As Integer
i = 0
While Not rs.EOF
i = i + 1
' 这里将显示当前后有用户任务列表
Debug.Print "------------" & i & "-------------"
Debug.Print rs("DisplayName")
Debug.Print rs("userID")
rs.MoveNext
Wend
End Sub
注意其中使用的一条select语句。它是用来访问WorkFlowServer数据用的。
再看看我用C#重写了这段代码。
private EPSDK.Connection CreateConnection(String userName, String password)
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](/Images/OutliningIndicators/ContractedBlock.gif)
{
EPSDK.Connection conn = new EPSDK.ConnectionClass();
conn.Open("DSN=Adobe WorkFlow Server","xuzhong","");
return conn;
}
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
private void button1_Click(object sender, System.EventArgs e)
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
{
EPSDK.Recordset rs = new EPSDK.RecordsetClass();
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
String strSql = "select DisplayName, UserID from Users";
![](/Images/OutliningIndicators/InBlock.gif)
EPSDK.Connection conn = this.CreateConnection("xuzhong","");
![](/Images/OutliningIndicators/InBlock.gif)
rs = conn.Execute( strSql );
![](/Images/OutliningIndicators/InBlock.gif)
while(!rs.EOF)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
String name = String.Format("{0,-30} {1}",
rs.Fields["DisplayName"].Value.ToString(),
rs.Fields["UserID"].Value.ToString()
);
Print( name );
rs.MoveNext();
}
}
它实现了与上面用VB写的一样的功能。