Muokkaa

Jaa


TaskRequestItem.GetAssociatedTask method (Outlook)

Returns a TaskItem object that represents the requested task.

Syntax

expression. GetAssociatedTask( _AddToTaskList_ )

expression A variable that represents a TaskRequestItem 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 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

See also

TaskRequestItem Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.