日付制限は、インスタンスのプロパティを調べる際に指定した日付の間に発生しかし定期的な予定のインスタンスをピックアップします - たとえば.IsRecurring
や.AllDayEvent
のために、Outlookは定期的な最初の方のポインタをリダイレクト任命(それまでの親)。これを繰り返す方法は、他のプロパティを調べて失う前に開始日と終了日(ローカル変数にコピーする)を調べることです。
Dim olNS As Outlook.Namespace
Dim olRec As Outlook.Recipient
Dim myCalItems As Outlook.Items
Dim strRestriction As String
Dim ItemstoCheck As Outlook.Items
Dim MyItem As Outlook.AppointmentItem
Dim datAppStart As Date
Dim datAppEnd As Date
Set myCalItems = olNS.GetSharedDefaultFolder(olRec, olFolderCalendar).Items
' Including recurrent appointments requires sorting by the Start property, apparently!
myCalItems.Sort "[Start]", False
myCalItems.IncludeRecurrences = True
strRestriction = "[Start]<= " & Quote(datEndDate & " 12:00 AM") & " AND [End] >= " & _
Quote(datStartDate & " 11:59 PM")
Set ItemstoCheck = myCalItems.Restrict(strRestriction)
For Each MyItem In ItemstoCheck
If MyItem.Class = olAppointment Then
'Save Start and end dates in case replaced by first instance of recurring appointment
datAppStart = MyItem.Start
datAppEnd = MyItem.End
など
これは私のための核心だった: '」再発の予定を含むが明らかに、スタートプロパティで並べ替えが必要です! myCalItems.Sort "[開始]"、偽 myCalItems.IncludeRecurrences = True' –