Export (0) Print
Expand All

Respond Method

Office 2003

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.

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:

Remarks

When you run a program that uses the Microsoft Outlook object model to call the Respond method, you receive a warning message. This warning message tells you that a program is trying to send an item on your behalf and asks if you want to allow this.

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 the response.

For TaskItem:

If the Display method has been called, the user prompt appears. Otherwise, the item is sent without prompting and the resulting item is nothing.

False, False For AppointmentItem:

New response item appears in the user interface, but no prompt is displayed.

For TaskItem:

Does nothing.


Example

This Visual Basic for Applications (VBA) example finds a MeetingItem in the default Inbox folder and adds the associated appointment to the Calendar folder. It then responds to the sender by accepting the meeting.

Sub AcceptMeeting()
	Dim myOlApp As New Outlook.Application
	Dim myNameSpace As Outlook.NameSpace
	Dim myFolder As Outlook.MAPIFolder
	Dim myMtgReq As Outlook.MeetingItem
	Dim myAppt As Outlook.AppointmentItem
	Dim myMtg As Outlook.MeetingItem
	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)
		Set myMtg = myAppt.Respond(olResponseAccepted, True)
		myMtg.Send
	End If
End Sub
		

If you use Microsoft Visual Basic Scripting Edition (VBScript) in an Outlook form, you do not create the Application object, and you cannot use named constants. This example shows how to perform the same task using VBScript in a CommandButton Click event.

Sub CommandButton1_Click()
 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 3, False, True
 Else
     MsgBox "You have no meeting requests."
 End If
End Sub
		




Show:
© 2015 Microsoft