title | keywords | f1_keywords | api_name | ms.assetid | ms.date | ms.localizationpriority | ||
---|---|---|---|---|---|---|---|---|
TaskRequestItem.GetAssociatedTask method (Outlook) |
vbaol11.chm1906 |
|
|
ec170266-9898-79d8-03e9-7ea38d789d40 |
06/08/2017 |
medium |
Returns a TaskItem object that represents the requested task.
expression. GetAssociatedTask
( _AddToTaskList_
)
expression A variable that represents a TaskRequestItem object.
Name | Required/Optional | Data type | Description |
---|---|---|---|
AddToTaskList | Required | Boolean | True if the task is added to the default Tasks folder. |
A TaskItem object that represents the requested task.
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.
This Microsoft Visual Basic for Applications (VBA) example accepts a TaskRequestItem, 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 mytaskreqItem As Outlook.TaskRequestItem
Dim myItem As Outlook.TaskItem
Set myNameSpace = Application.GetNamespace("MAPI")
Set myTasks = myNameSpace.GetDefaultFolder(olFolderInbox)
Set mytaskreqItem = myTasks.Items.Find("[Subject] = ""Meeting w/ Nate Sun""")
If Not TypeName(mytaskreqItem) = "Nothing" Then
Set myNewTaskItem = mytaskreqItem.GetAssociatedTask(True)
Set myItem = myNewTaskItem.Respond(olTaskAccept, True, True)
myItem.Send
End If
End Sub
[!includeSupport and feedback]