none
How to change Recurrence EndDate? RRS feed

  • Question

  • getting this error while gerenating recurring meeting request using Exhcnage Webservice 2007 "One occurrence of the recurring calendar item overlaps with another occurrence of the same calendar item."

    Appointment appointment = new Appointment(service);
                    appointment.StartTimeZone = TimeZoneInfo.Local;
                    List<DayOfTheWeek> dayList1 = new List<DayOfTheWeek>();
                    dayList1.Add(DayOfTheWeek.Sunday);
                    appointment.Recurrence = new Recurrence.WeeklyPattern(startDateTime, 1, dayList1.ToArray());
                    appointment.Start = startDateTime;
                    appointment.End = endDateTime;
                    appointment.Recurrence.StartDate = appointment.Start.Date;
                    appointment.Recurrence.EndDate = appointment.End.Date;
                    appointment.Save(WellKnownFolderName.Calendar, SendInvitationsMode.SendToAllAndSaveCopy);


    Please help me in solving the issue

    • Edited by Lucas Chi Tuesday, October 14, 2014 1:59 PM ok
    Tuesday, October 14, 2014 1:33 PM

Answers

  • Thank you

    I got the solution.

    Appointment.Start is the begining datetime

    Appointment.End is the ending datetime,must set the date of Appointment.End as same as the date of Appointment.Start

    like this:

    appointment.Start = startDateTime;
    appointment.End = Convert.ToDateTime(startDateTime.ToString("yyyy-MM-dd") + endDateTime.ToString(" HH:mm:ss"));


    • Edited by Lucas Chi Wednesday, October 15, 2014 4:15 AM solution
    • Marked as answer by Lucas Chi Wednesday, October 15, 2014 4:15 AM
    Wednesday, October 15, 2014 4:14 AM

All replies

  • Your request isn't valid because for a recurring appointment you have to have more then one occurrence in you series so in your example setting the recurrence values to the same values as the start and end date eg

                    appointment.Recurrence.StartDate = appointment.Start.Date;
                    appointment.Recurrence.EndDate = appointment.End.Date;

    makes this invalid. What you trying to do ? The recurrence EndDate is the when you want this recurring series to end (this is optional for recurring series) so if you want this to valid for say 1 year add 1 year to the EndDate.

    Cheers
    Glen

    Wednesday, October 15, 2014 3:16 AM
  • Thank you

    I got the solution.

    Appointment.Start is the begining datetime

    Appointment.End is the ending datetime,must set the date of Appointment.End as same as the date of Appointment.Start

    like this:

    appointment.Start = startDateTime;
    appointment.End = Convert.ToDateTime(startDateTime.ToString("yyyy-MM-dd") + endDateTime.ToString(" HH:mm:ss"));


    • Edited by Lucas Chi Wednesday, October 15, 2014 4:15 AM solution
    • Marked as answer by Lucas Chi Wednesday, October 15, 2014 4:15 AM
    Wednesday, October 15, 2014 4:14 AM