共用方式為


DocumentBase.GetWorkflowTasks 方法

傳回指派給文件的工作流程工作。

命名空間:  Microsoft.Office.Tools.Word
組件:  Microsoft.Office.Tools.Word.v4.0.Utilities (在 Microsoft.Office.Tools.Word.v4.0.Utilities.dll 中)

語法

'宣告
Public Function GetWorkflowTasks As WorkflowTasks
public WorkflowTasks GetWorkflowTasks()

傳回值

型別:Microsoft.Office.Core.WorkflowTasks
Microsoft.Office.Core.WorkflowTasks 集合,包含指派給文件的工作流程工作。

範例

下列程式碼範例會顯示目前與文件相關聯的工作流程工作數目。 這個範例接著會逐一查看每個工作流程工作 (如果有的話),並在訊息方塊中顯示一些選取的工作屬性。

若要將工作流程工作加入至文件,您必須將文件發行至 Office SharePoint Server 網站。 若要使用這個範例,請在文件層級專案中的 ThisDocument 類別執行。

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 安全性

請參閱

參考

DocumentBase 類別

Microsoft.Office.Tools.Word 命名空間