GetAssociatedAppointment Method Example
This Visual Basic for Applications example finds a MeetingItem in the default Inbox folder and adds the associated appointment to the Calendar folder.
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)
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)
End If
This example accepts a meeting request, sending the response without displaying the inspector.
Set myNewMeeting = myMtgReq.GetAssociatedAppointment(True)
myNewMeeting.Respond olResponseAccepted, True