How to read single instance of recursive meetings in Outlook




I am creating an Add-in for Outlook in . I need to read the
meetings between a given duration from a shared calendar. I am able
read the non recursive meetings but when i try to read the recursive
meetings it always gives an item count of "2147483647".
I want the total count of meetings ( recursive + non recursive)
between the given time which should count only that instance of the
recursive meeting .
Here is the code sample which i am using:
Dim oApp As New Microsoft.Office.Interop.Outlook.Application
Dim oappt As Microsoft.Office.Interop.Outlook.AppointmentItem
Dim oNs As Microsoft.Office.Interop.Outlook.NameSpace
Dim oCalendar As Microsoft.Office.Interop.Outlook.MAPIFolder
Dim instance As Microsoft.Office.Interop.Outlook.Items
Dim oItems As Microsoft.Office.Interop.Outlook.Items
Dim recipient As Microsoft.Office.Interop.Outlook.Recipient
Dim oTask As Microsoft.Office.Interop.Outlook.TaskItem
Dim sSearch As String
Dim name1 As String
Dim date1 As String
oNs = oApp.GetNamespace("mapi")
name1 = TextBox1.Text
date1 = DateTimePicker1.Text
recipient = oNs.CreateRecipient(name1)
oCalendar = oNs.GetSharedDefaultFolder(recipient,
oItems = oCalendar.Items
oItems.IncludeRecurrences = True
sSearch = "[START] >= '" & Format(date1) & " " & j & " ' and [START]
<= '" & Format(date1) & " " & k & " ' or [START] <'" &
Format(date1) & " " & j & " ' and [END] > '" & Format(date1) & " " &
j & " ' "
oItems = oItems.Restrict(sSearch)
If oItems.Count > 0 Then
TextBox3.Text = "Busy"
TextBox3.Text = "Free"
End If

Can anyone please suggest me how to proceed.

Thank you

Ken Slovak - [MVP - Outlook]

If a recurring series has no end date and you set IncludeRecurrences you
will always get that count of recurrences.

You will need to get the starting instance using the GetOccurrence() method
and then you need to add the recurrence pattern to that start date and
derive the next date and use GetOccurrence() again, and so on. If a specific
occurrence isn't found for a specific date you then need to examine the
Exceptions collection to find if an occurrence on that date was moved or

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question