WorkbookBase.GetWorkflowTasks 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
傳回活頁簿工作流程工作的集合。
public:
Microsoft::Office::Core::WorkflowTasks ^ GetWorkflowTasks();
public Microsoft.Office.Core.WorkflowTasks GetWorkflowTasks ();
member this.GetWorkflowTasks : unit -> Microsoft.Office.Core.WorkflowTasks
Public Function GetWorkflowTasks () As WorkflowTasks
傳回
Microsoft.Office.Core.WorkflowTasks 集合,包含活頁簿的工作流程工作。
範例
下列程式代碼範例會顯示目前與活頁簿相關聯的工作流程工作數目。 然後範例會逐一查看每個工作流程工作,如果有的話,並在消息框中顯示一些選取的任務屬性。
若要將工作流程工作新增至活頁簿,您必須將活頁簿發佈至 Office Sharepoint Server 網站。
此範例適用於檔層級自定義。
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);
}
}
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