locked
WebServices - how to get a current index from a recurring appointment RRS feed

  • Question

  • Hello,

    I'm importing calendar appointments from Exchange into an ERP system. What I'm trying to figure out are recurring appointments. If I fetch an Appointment from the calendar view and it's a recurring appointment of the AppointmentType=Occurrence... how can I get the OccurenceIdx from that one?

    Example:

                    foreach (Appointment localAppointment in searchResults)
                    {
                        localAppointment.Load(appointmentProperties);
                        if (localAppointment.AppointmentType == AppointmentType.Exception || localAppointment.AppointmentType)

                        {

                                            //TODO: print CurrentIndex

                        }

                    }

     My understanding is, that all appointments in a series have the same UniqueId... is that correct?

    Many thanks,

    Martin

    Thursday, January 9, 2014 7:51 AM

Answers

  • You need to be careful using the UniqueID (or EWSId) as this can change for a number of reasons. While its nice that you can bind to the appointment directly best practice would be to store the CleanObjectId see http://blogs.msdn.com/b/mstehle/archive/2009/09/02/ews-uid-not-always-the-same-for-orphaned-instances-of-the-same-meeting.aspx?Redirected=true . So if the Appointments EWSId does change your database reference will still point to the correct appointment object. It does require that you search for the appointment first whenever you need to bind (you could store both).

    If your going to store anything for a recurrence use the Start and End time. Recurrence patterns are based on time so if you going to locate a particular instance then you can search for the appointment for that start and end time and then filter it at the ClientSide based on the CleanObjectId. You still need to handle exceptions where someone has changed the Start and End time or deleted the appointment.

    There are no simple options when it comes to synchronization of calendaring data, mainly because the underlying data types are complex (eg recurrence patterns are complex if you exclude recurring appointments then its simple).

    Cheers
    Glen

    • Marked as answer by Martin Abrle Monday, January 13, 2014 6:50 AM
    Sunday, January 12, 2014 11:34 PM

All replies

  • What I would suggest is getting a copy of the Inside Exchange Web Services book which has a good explanation of this and how indexing works see http://books.google.com.au/books?id=9I0g-GAKm6YC&pg=PT706&lpg=PT706&dq=Chapter+9+Recurrences+and+Time+Zones

    Its a complicated subject but essentially with a recurrence there is one physical Store object (the master instance), for normal recurrences (where there is no exception data) there is no physical objects just the recurrence pattern which tells the client how to expand them. For Exceptions and Deleted exceptions these are stored as attachments on the Master instance object for the recurrence so they do have separate Ids.

    Cheers
    Gllen

    Friday, January 10, 2014 4:46 AM
  • Thanks for your answer, I had a look into this book and - well, most of the sync has been working for two years, this is just a new requirement; I also went through the MS docs here on msdn...

    I understand that there is just one physical (master) appointment and the calendar view gives back the recurrences "on the fly", even though these do not really exist in the store. Therefore the calendar view does not give back the master (am I right here?)

    I'm using the EWS DLL - and I'm not really writing the XML messages.As far as I understand, the UniqueID is always the same for recurrent appointments and can be used to retrieve the master.

    What I'm looking for is an easy way to reference recurrent Appointments from my database (ERP application), i.e. having a uniqueId and recurrentIdx or something similar would help.

    What's the best practice for that?

    Note:I can't just write the master appointment into the database (ERP), people doing further development on some scheduling software need to have a record for each recurrence. Should I use UniqueId + StartDate?

    Friday, January 10, 2014 9:16 AM
  • You need to be careful using the UniqueID (or EWSId) as this can change for a number of reasons. While its nice that you can bind to the appointment directly best practice would be to store the CleanObjectId see http://blogs.msdn.com/b/mstehle/archive/2009/09/02/ews-uid-not-always-the-same-for-orphaned-instances-of-the-same-meeting.aspx?Redirected=true . So if the Appointments EWSId does change your database reference will still point to the correct appointment object. It does require that you search for the appointment first whenever you need to bind (you could store both).

    If your going to store anything for a recurrence use the Start and End time. Recurrence patterns are based on time so if you going to locate a particular instance then you can search for the appointment for that start and end time and then filter it at the ClientSide based on the CleanObjectId. You still need to handle exceptions where someone has changed the Start and End time or deleted the appointment.

    There are no simple options when it comes to synchronization of calendaring data, mainly because the underlying data types are complex (eg recurrence patterns are complex if you exclude recurring appointments then its simple).

    Cheers
    Glen

    • Marked as answer by Martin Abrle Monday, January 13, 2014 6:50 AM
    Sunday, January 12, 2014 11:34 PM
  • Thanks so much!!!!
    Monday, January 13, 2014 6:51 AM