TaskRequestUpdateItem.GetAssociatedTask Method (Outlook)
Returns a TaskItem object that represents the requested task.
Syntax
expression .GetAssociatedTask(AddToTaskList)
expression A variable that represents a TaskRequestUpdateItem object.
Parameters
Name |
Required/Optional |
Data Type |
Description |
---|---|---|---|
AddToTaskList |
Required |
Boolean |
True if the task is added to the default Tasks folder. |
Return Value
A TaskItem object that represents the requested task.
Remarks
The GetAssociatedTask method will not work unless the TaskItem is processed before the method is called. To do so, call the Display method before calling GetAssociatedTask.
Example
This Microsoft Visual Basic for Applications (VBA) example accepts a TaskRequestUpdateItem Object, sending the response without displaying the inspector.
Sub AcceptTask()
Dim myNameSpace As Outlook.NameSpace
Dim myTasks As Outlook.Folder
Dim myNewTaskItem As Outlook.TaskItem
Dim mytaskrequpdateItem As Outlook.TaskRequestUpdateItem
Dim myItem As Outlook.TaskItem
Set myNameSpace = Application.GetNamespace("MAPI")
Set myTasks = myNameSpace.GetDefaultFolder(olFolderInbox)
Set mytaskrequdpateItem = myTasks.Items.Find("[Subject] = ""Meeting w/ Nate Sun""")
If Not TypeName(mytaskrequpdateItem) = "Nothing" Then
Set myNewTaskItem = mytaskrequpdateItem.GetAssociatedTask(True)
Set myItem = myNewTaskItem.Respond(olTaskAccept, True, True)
myItem.Send
End If
End Sub