Compartir a través de


DocumentBase.GetWorkflowTemplates Method

Definition

Returns the workflow templates that are attached to the document.

public:
 Microsoft::Office::Core::WorkflowTemplates ^ GetWorkflowTemplates();
public Microsoft.Office.Core.WorkflowTemplates GetWorkflowTemplates ();
member this.GetWorkflowTemplates : unit -> Microsoft.Office.Core.WorkflowTemplates
Public Function GetWorkflowTemplates () As WorkflowTemplates

Returns

A WorkflowTemplates collection that contains the workflow templates that are attached to the document.

Examples

The following code example displays the number of workflow templates that are available for the document. If one or more workflow templates exist, the example displays the name and description of each template.

To run this code example, you must publish the document to an Office Sharepoint Server site. To use this example, run it from the ThisDocument class in a document-level project.

private void DisplayWorkflowTemplates()
{
    Office.WorkflowTemplates workflowTemplates = 
        this.GetWorkflowTemplates();
    MessageBox.Show("Number of workflow templates found: " 
        + workflowTemplates.Count.ToString());
    StringBuilder sb = new StringBuilder();
    sb.Append("Workflow Template List\r\n");
    foreach (Office.WorkflowTemplate template in workflowTemplates)
    {
        sb.Append("\r\n" + template.Name + " Template\r\n"
            + "Description: " + template.Description);
    }
    if (workflowTemplates.Count > 0)
    {
        MessageBox.Show(sb.ToString());
    }
}
Private Sub DisplayWorkflowTemplates()
    Dim workflowTemplates As Office.WorkflowTemplates = _
        Me.GetWorkflowTemplates()
    MessageBox.Show("Number of workflow templates found: " _
        + workflowTemplates.Count.ToString())
    Dim sb As StringBuilder = New StringBuilder()
    sb.Append("Workflow Template List" + vbCrLf)
    For Each template As Office.WorkflowTemplate In workflowTemplates
        sb.Append(vbCrLf + template.Name + " Template" + vbCrLf _
            + "Description: " + template.Description)
    Next
    If workflowTemplates.Count > 0 Then
        MessageBox.Show(sb.ToString())
    End If
End Sub

Applies to