WorkbookBase.GetWorkflowTasks 方法
返回工作簿的工作流任务的集合。
命名空间: Microsoft.Office.Tools.Excel
程序集: Microsoft.Office.Tools.Excel.v4.0.Utilities(在 Microsoft.Office.Tools.Excel.v4.0.Utilities.dll 中)
语法
声明
Public Function GetWorkflowTasks As WorkflowTasks
public WorkflowTasks GetWorkflowTasks()
返回值
类型:Microsoft.Office.Core.WorkflowTasks
一个 Microsoft.Office.Core.WorkflowTasks 集合,包含工作簿的工作流任务。
示例
下面的代码示例将显示当前与工作簿关联的工作流任务的数目。然后,该示例将循环访问每个工作流任务(如果有),并在消息框中显示选定的某些任务属性。
若要在工作簿中添加工作流任务,必须将该工作簿发布到 Office Sharepoint Server 网站。
此示例针对的是文档级自定义项。
Private Sub DisplayWorkflowTasks()
Dim tasks As Office.WorkflowTasks = Me.GetWorkflowTasks()
If tasks.Count > 1 Then
MessageBox.Show("There are " + tasks.Count.ToString() _
+ " workflow tasks.")
ElseIf tasks.Count = 1 Then
MessageBox.Show("There is " + tasks.Count.ToString() _
+ " workflow task.")
ElseIf tasks.Count = 0 Then
MessageBox.Show( _
"No workflow tasks are associated with this document.")
End If
For Each task As Office.WorkflowTask In tasks
MessageBox.Show( _
"Workflow Task ID: " + task.Id _
+ vbCrLf + "Workflow Task Name: " + task.Name _
+ vbCrLf + "Assigned To: " + task.AssignedTo _
+ vbCrLf + "Description: " + task.Description)
Next
End Sub
private void DisplayWorkflowTasks()
{
Office.WorkflowTasks tasks = this.GetWorkflowTasks();
if (tasks.Count > 1)
{
MessageBox.Show("There are " + tasks.Count.ToString()
+ " workflow tasks.");
}
else if (tasks.Count == 1)
{
MessageBox.Show("There is " + tasks.Count.ToString()
+ " workflow task.");
}
else if (tasks.Count == 0)
{
MessageBox.Show(
"No workflow tasks are associated with this document.");
}
foreach (Office.WorkflowTask task in tasks)
{
MessageBox.Show(
"Workflow Task ID: " + task.Id
+ "\r\nWorkflow Task Name: " + task.Name
+ "\r\nAssigned To: " + task.AssignedTo
+ "\r\nDescription: " + task.Description);
}
}
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。