This documentation is archived and is not being maintained.

TaskItem Interface

The TaskItem object represents a task item in the Task List window.

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

public interface TaskItem

In this example, the tasks appear in the Add-ins and Macros category of the Task List.

[Visual Basic]

[Visual Basic]

Sub TaskItemExample()
   Dim win As Window = DTE.Windows.Item(Constants.vsWindowKindTaskList)
   Dim TL As TaskList = win.Object
   Dim TLItem As TaskItem

   ' Add a couple of tasks to the Task List.
   TLItem = TL.TaskItems.Add(" ", " ", "Test task 1.", vsTaskPriority.vsTaskPriorityHigh, vsTaskIcon.vsTaskIconUser, True, , 10, , )
   TLItem = TL.TaskItems.Add(" ", " ", "Test task 2.", vsTaskPriority.vsTaskPriorityLow, vsTaskIcon.vsTaskIconComment, , 20, , )

   ' List the total number of task list items after adding the new 
   ' task items.
   MsgBox("Task Item 1 description: " & TL.TaskItems.Item(2).Description)
   MsgBox("Total number of task items: " & TL.TaskItems.Count)

   ' Remove the second task item. The items list in reverse numeric order.
   MsgBox("Deleting the second task item")
   MsgBox("Total number of task items: " & TL.TaskItems.Count)
End Sub