Inconsistent Results Retrieving Recurring Appointments

T

Tadwick

Hi Folks,

I'm getting inconsistent results when retrieving appointment items using
IncludeRecurrence = True. Here is a table of appointment item parameters for
two items (two different recipients). The code to loop through the
appointments is shown below. The problem is that for the first item (shown
in the second column), the code keeps returning the appointment master
instead of the individual occurence. Would appreciate any assistance with
this.

Thanks, Tad
__________________________________________

BusyStatus olFree olOutOfOffice
ConversationIndex "01C6D6971ECA2BBD6FE74F0F426E8F "01C6D12BD7AC7BCD168E943A488A88
ConversationTopic "XXX" "YYY"
CreationTime #2006-09-12 11:12:03 AM AM# #2006-09-21 9:13:50 AM AM#
End #2006-10-21# #2006-09-12#
EntryID "00000000D1B938DFB2CC7D48834847 "00000000A7781820E0C6D411B26000String
LastModificationTime #2006-09-12 11:13:53 AM AM# #2006-09-10 6:35:55 AM PM#
MessageClass "IPM.Appointment" "IPM.OLE.CLASS.{00061055-0000-0
Organizer "XXXXXXX" "YYYYYYY"
OutlookInternalVersion 118002 115608
Parent Object/MAPIFolder Object/AppointmentItem
RecurrenceState olApptMaster olApptOccurrence
ReminderSet TRUE FALSE
Size 668 134
Start #2006-10-20# #2006-09-11#
Subject "XXX" "YYY"


________________________________________



Public oApp As Outlook.Application
Public oNS As Outlook.NameSpace
Public oAL As Outlook.AddressList
_____________________________________
Sub GetRecipientAppointments(recipient As String)

Dim oRcp As Outlook.recipient
Dim oFdr As Outlook.MAPIFolder
Dim oItms As Outlook.Items
Dim oAItm As Outlook.AppointmentItem
Dim datStart As Date
Dim datEnd As Date
Dim datRecent As Date
Dim strFind As String

Set oApp = Application
Set oNS = oApp.GetNamespace("MAPI")
Set oAL = oNS.AddressLists("Global Address List")
Set oRcp = oNS.CreateRecipient(recipient)
'Get recipient calendar info
On Error Resume Next
Set oFdr = oNS.GetSharedDefaultFolder(oRcp, olFolderCalendar)
On Error GoTo 0
If oFdr Is Nothing Then
Debug.Print recipient & " -- access denied --"
Else
Set oItms = oFdr.Items
oItms.SetColumns
("Subject,Start,End,BusyStatus,LastModificationTime,IsRecurring")
oItms.Sort "[Start]", False
oItms.IncludeRecurrences = True

datStart = DateSerial(Year(Date), Month(Date), 1)
datEnd = DateAdd("m", 6, datStart)
datRecent = DateAdd("m", -1, datStart)
strFind = "([End] > '" + Format(datStart, "mmmm dd, yyyy") + " ' AND
[Start] < '" + Format(datEnd, "mmmm dd, yyyy") + "') "

Set oAItm = oItms.Find(strFind) '(strFind)

Do While TypeName(oAItm) <> "Nothing"

Debug.Print oAItm.Start & " " & oAItm.End & " " & oAItm.Subject & "
" & oAItm.IsRecurring
Set oAItm = oItms.FindNext
Loop

End If
Set oFdr = Nothing

End Sub
 

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

Top