Respond Method
Responds to a meeting request for the AppointmentItem object or a task request for the TaskItem object.
expression.Respond(Response, fNoUI, fAdditionalTextDialog)
expression Required. An expression that returns an AppointmentItem or TaskItem object.
Response Required OlMeetingResponse. The response to the request.
OlMeetingResponse can be one of these OlMeetingResponse constants. |
For an AppointmentItem object: |
olMeetingAccepted |
olMeetingDeclined |
olMeetingTentative |
For a TaskItem object: |
olTaskAccept |
olTaskAssign |
olTaskDecline |
olTaskSimple |
fNoUI Optional for AppointmentItem, required for TaskItem. Boolean. True to not display a dialog box; the response is sent automatically. False to display the dialog box for responding.
fAdditionalTextDialog Optional for AppointmentItem, required for TaskItem. Boolean. False to not prompt the user for input; the response is displayed in the inspector for editing. True to prompt the user to either send or send with comments. This argument is valid only if fNoUI is False.
Note The possible values for the optional parameters, fNoUI and fAdditionalTextDialog and the subsequent results are as follows:
fNoUI, fAdditionalTextDialog | Result |
---|---|
True, True | For AppointmentItem and TaskItem:
Response item is returned with no user interface. To send the response, you must call the Send method. |
True, False | For AppointmentItem and TaskItem:
Same result as with True, True. |
False, True | For AppointmentItem:
Prompts user to Send or Edit before sending response. For TaskItem: If Display method has been called, the user prompt appears. Otherwise, the item is sent without prompting and resulting item is nothing. |
False, False | For AppointmentItem:
New response item appears in the user interface, but no prompt. For TaskItem: Does nothing. |
Example
This Visual Basic for Applications example uses the Find method to locate a MeetingItem in the user's Inbox. If there are no meeting items, the user is informed. If a meeting item is located, the GetAssociatedAppointment method is called to get the AppointmentItem and the Respond method allows acceptance.
Set myOlApp = CreateObject("Outlook.Application")
Set myNamespace = myOlApp.GetNamespace("MAPI")
Set myFolder = myNamespace.GetDefaultFolder(olFolderInbox)
Set myMtgReq = myFolder.Items.Find("[MessageClass] = 'IPM.Schedule.Meeting.Request'")
If TypeName(myMtgReq) <> "Nothing" Then
Set myAppt = myMtgReq.GetAssociatedAppointment(True)
myAppt.Respond olResponseAccepted, False, True
Else
MsgBox "You have no meeting requests."
End If
If you use VBScript, you do not create the Application object, and you cannot use named constants. This example shows how to perform the same task using VBScript.
Set myNamespace = Application.GetNamespace("MAPI")
Set myFolder = myNamespace.GetDefaultFolder(6)
Set myMtgReq = myFolder.Items.Find("[MessageClass] = 'IPM.Schedule.Meeting.Request'")
If TypeName(myMtgReq) <> "Nothing" Then
Set myAppt = myMtgReq.GetAssociatedAppointment(True)
myAppt.Respond olResponseAccepted, False, True
Else
MsgBox "You have no meeting requests."
End If