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 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。