none
EWS Managed API: Getting index value of calendar item in a recurring events RRS feed

  • Question

  • I am trying to update single occurrence of the recurring event using EWS managed API.
    int index = 1;
    Appointment occurrence = Appointment.BindToOccurrence(service, new ItemId(recurringMasterId), index);
    occurrence.Start = StartDate;
    occurrence.End = EndDate;
    occurrence.Update(ConflictResolutionMode.AlwaysOverwrite);

    To update the occurrence, I have to provide index value of that occurrence in the recurring series. My problem is that I am not sure from where I can get the index value.

    One article I found on MSDN site (Url: http://msdn.microsoft.com/en-us/library/dd633700%28v=exchg.80%29.aspx) suggests to rotate loop for the sRecurringMasterId and inspect each resultant appointments in order to get index value.

    Thank you in advance.
    Wednesday, February 22, 2012 9:33 PM

Answers

  • Depends what your trying to achieve eg if you just created a recurring appointment with 10 recurrences and you wanted to modify the 5th and 7th occurrence this is when you would use this BindToOccurrence Method.  Or if you wanted to walk each occurrence you would start from 1 and bind to each occurrence in turn. A recurrence can have no end so in theory you could have an infinite number of occurrences.

    If you want to modify an occurrence that occurs on a particular day what you would normal do is use a CalendarView to find all the Items that occur during that day (or narrow the time range if you can). Filter at the clients side based on the Subject or other appointmentId etc to ensure you only modify the Instance you want.

    The Index itself is virtual and the ExchangeServer is calculating which appointment your requesting by expanding the recurrence patterns to determine what appointment to return when your using BindToOccurrence

    Cheers
    Glen

    • Marked as answer by Firoz A Thursday, February 23, 2012 7:02 PM
    Thursday, February 23, 2012 5:26 AM

All replies

  • Depends what your trying to achieve eg if you just created a recurring appointment with 10 recurrences and you wanted to modify the 5th and 7th occurrence this is when you would use this BindToOccurrence Method.  Or if you wanted to walk each occurrence you would start from 1 and bind to each occurrence in turn. A recurrence can have no end so in theory you could have an infinite number of occurrences.

    If you want to modify an occurrence that occurs on a particular day what you would normal do is use a CalendarView to find all the Items that occur during that day (or narrow the time range if you can). Filter at the clients side based on the Subject or other appointmentId etc to ensure you only modify the Instance you want.

    The Index itself is virtual and the ExchangeServer is calculating which appointment your requesting by expanding the recurrence patterns to determine what appointment to return when your using BindToOccurrence

    Cheers
    Glen

    • Marked as answer by Firoz A Thursday, February 23, 2012 7:02 PM
    Thursday, February 23, 2012 5:26 AM
  • You are right. Using index was not proper method to fetch single occurrence in my case.

    As you suggested, I am now using CalendarView to find all occurrences for specific time range and then I am comparing ICalUid of each returned occurrences with RecurringMasterId.

    Thanks Glen.

    • Edited by Firoz A Thursday, February 23, 2012 7:03 PM
    Thursday, February 23, 2012 7:02 PM