Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I've been struggling with exactly the same issue for the last couple of hours, and finally I have arrived at a solution. It seems as though GetOccurrence() always throws that error unless the DateTime value that is passed matches an instance of the recurring appointment - and the thing that caught me out was that the DateTime value has to match on both Date <strong>AND</strong> Time.</p> <p>Here's a version of your code that takes the time from the RecurrencePattern and adds it to the DateTime value passed to GetOccurence(), which then should correctly find any instance of the appointment that falls on the selected date.</p> <pre><code>Dim item As Outlook.AppointmentItem = Nothing item = calFolder.Items.Item(itemIndex) If item.IsRecurring Then Dim rp As Outlook.RecurrencePattern = Nothing rp = item.GetRecurrencePattern() Dim dt2 as DateTime = DateTime.Parse("8/28/2012") dt2 = dt2.AddHours(item.Start.Hour) dt2 = dt2.AddMinutes(item.Start.Minute) dt2 = dt2.AddSeconds(item.Start.Second) item.Close(Outlook.OlInspectorClose.olDiscard) CleanUpComObject(item) item = Nothing GC.Collect() Try rp.GetOccurrence(dt2) Catch ex1 As System.Runtime.InteropServices.COMException // Do Nothing, let this error go. No instance of the appointment falls on this date. Catch ex As System.Exception Debug.WriteLine("Ex with GetOccurrence: " &amp; ex.Message) End Try End If </code></pre> <p>Note that I am a C# developer, so there may well be syntax errors in the above as it's an amalgamation of the OP's code and my code converted from C#, and has not been passed through a compiler.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload