Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
120
Re: DateRecurrence behavior on ProjectCalendarException
posted

Hi,

this now looks really promising and finally works like expected. Thanks very much.

One thing I've noticed now, is that the integrated function ToExceptionsXml doesn't take the rules added to an exception into account, so they can't be easily stored.
I will circumvent now around this in my project, but can you have a look at this as well or should I open a new forum entry for this (possibly not desired) behaviour?

Thanks,
Stefan 

Parents
No Data
Reply
  • 3520
    Offline posted

    Hi Stefan,

    I have investigated the behavior of ProjectCalendar.ToExceptionsXml() method, and I have asked our engineering staff to examine this further.  To ensure that it will receive attention, I have logged this behavior in our internal tracking system with a Development ID of 242070. This will be assigned to a developer in a future sprint to review my investigation and confirm my findings or to offer a fix, or other resolution.

    In the meantime what I can suggest as a workaround in order to properly save the ProjectCalendarExceptions is to use a combination of ProjectCalendar.ToExceptionsXml() and DateRecurrence.ToICalendarString() methods. The second method would save the rules properly so they can be restored and reassigned to the ProjectCalendarException instance later. A very simplified implementation of the suggested approach should look as follows:


    List<DateRecurrence> dateRecurrences = new List<DateRecurrence>();

    foreach (var recurrence in recurrences)

        dateRecurrences.Add(DateRecurrence.FromICalendarString(recurrence));

    var projectExceptions = ProjectCalendar.FromExceptionsXml(strExceptions); 

    for (int i = 0; i < projectExceptions.Count; i++)

    {

      projectExceptions[i].Recurrence = dateRecurrences[i];

    }

    Please let me know if you need more information.

Children