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