'Determine if an Outlook event is a meeting and what the response was
I'm trying to write a macro in Excel that will look through my Outlook calendar, grab all the events, and display the following information: subject, start time, whether this event was from an meeting invite, and my response.
I've the first two piece of information down. How do I figure out the last two?
Dim olApp As Object
Dim olNS As Object
Dim olFolder As Object
Dim olApt As Object
Dim NextRow As Long
Set olApp = CreateObject("Outlook.Application")
Set olNS = olApp.GetNamespace("MAPI")
Set olFolder = olNS.GetDefaultFolder(9) 'olFolderCalendar
Range("A1:C1").Value = Array("Subject", "Start", "Meeting?", "Response")
NextRow = 2
For Each olApt In olFolder.Items
Cells(NextRow, "A").Value = olApt.Subject
Cells(NextRow, "B").Value = Format(olApt.Start, "MM-dd-yyyy")
Cells(NextRow, "C").Value = olApt.MeetingOrNot
Cells(NextRow, "C").Value = olApt.MeetingResponse
NextRow = NextRow + 1
Next olApt
Obviously MeetingOrNot and MeetingResponse are not valid attributes.
Solution 1:[1]
Use MeetingStatus property (olMeetingReceived, etc.) and ResponseStatus property (olResponseAccepted etc.).
To see all properties exposed by the AppointmentItem
object, see its documentation on MSDN or take a look at an appointment with OutlookSpy (I am its author) - select an appointment and click Item button to see the live AppointmentItem object. Or click IMessage button to see the Extended MAPI properties.
Solution 2:[2]
I can answer half your question. You want to look at the MessageClass
property of the inbox item - you want it to be of the AppointmentItem
type (olAppointmentItem
).
See http://msdn.microsoft.com/en-us/library/office/aa171490(v=office.11).aspx
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | Floris |