Hi,
We are facing critical issue here with Calender control and which needs to be fixed TODAY itself. Seeking urgent support in this.
We are passing parameter as Interval :14 and Recurrence is DailyPattern as seen in the screenshot but the rule is creating as DailyPattern and Interval: 1 which is incorrect.
Interval must be 14 as we have passed but the function :
var rrule = RecurrenceRule.FromPatternAndRange(schedulerPattern, schedulerRange); >> Creating Interval as 1 instead of 14.
Complete function code is attached:
Please help us in this URGENT as we need to fix today.
We are facing critical issue here with Calender control and which needs to be fixed TODAY itself. Seeking urgent support in this.
We are passing parameter as Interval :14 and Recurrence is DailyPattern as seen in the screenshot but the rule is creating as DailyPattern and Interval: 1 which is incorrect.
Interval must be 14 as we have passed but the function :
var rrule = RecurrenceRule.FromPatternAndRange(schedulerPattern, schedulerRange); >> Creating Interval as 1 instead of 14.
Complete function code is attached:
private
RecurrenceRule CreateRecurrenceRule(Appointment appq, ExchangeService service)
{
var pattern = (Microsoft.Exchange.WebServices.Data.Recurrence.IntervalPattern)appq.Recurrence;
var interval = pattern.Interval;
var schedulerPattern =
new
RecurrencePattern();
var schedulerRange =
new
RecurrenceRange { Start = appq.Start, EventDuration = appq.Duration };
if
(!appq.Recurrence.HasEnd) { }
else
{
if
(appq.Recurrence.NumberOfOccurrences !=
null
)
schedulerRange.MaxOccurrences = Convert.ToInt32(appq.Recurrence.NumberOfOccurrences);
else
if
(appq.Recurrence.EndDate !=
null
)
schedulerRange.RecursUntil = Convert.ToDateTime(appq.Recurrence.EndDate).Date.AddMinutes(appq.Duration.Minutes);
if
(appq.Recurrence.GetType() ==
typeof
(Microsoft.Exchange.WebServices.Data.Recurrence.DailyPattern) || appq.Recurrence.GetType() ==
typeof
(Microsoft.Exchange.WebServices.Data.Recurrence.DailyRegenerationPattern))
{
schedulerPattern.Frequency = RecurrenceFrequency.Daily;
schedulerPattern.Interval = interval;
}
else
if
(appq.Recurrence.GetType() ==
typeof
(Microsoft.Exchange.WebServices.Data.Recurrence.WeeklyPattern) || appq.Recurrence.GetType() ==
typeof
(Microsoft.Exchange.WebServices.Data.Recurrence.WeeklyRegenerationPattern))
{
var weekpattern = (Microsoft.Exchange.WebServices.Data.Recurrence.WeeklyPattern)appq.Recurrence;
schedulerPattern.Frequency = RecurrenceFrequency.Weekly;
schedulerPattern.Interval = interval;
var dayOfWeekMask =
new
RecurrenceDay();
foreach
(var day
in
weekpattern.DaysOfTheWeek)
{
switch
(day)
{
case
DayOfTheWeek.Monday: dayOfWeekMask = dayOfWeekMask | RecurrenceDay.Monday;
break
;
case
DayOfTheWeek.Tuesday: dayOfWeekMask = dayOfWeekMask | RecurrenceDay.Tuesday;
break
;
case
DayOfTheWeek.Wednesday: dayOfWeekMask = dayOfWeekMask | RecurrenceDay.Wednesday;
break
;
case
DayOfTheWeek.Thursday: dayOfWeekMask = dayOfWeekMask | RecurrenceDay.Thursday;
break
;
case
DayOfTheWeek.Friday: dayOfWeekMask = dayOfWeekMask | RecurrenceDay.Friday;
break
;
case
DayOfTheWeek.Saturday: dayOfWeekMask = dayOfWeekMask | RecurrenceDay.Saturday;
break
;
case
DayOfTheWeek.Sunday: dayOfWeekMask = dayOfWeekMask | RecurrenceDay.Sunday;
break
;
}
}
schedulerPattern.DaysOfWeekMask = dayOfWeekMask;
}
else
if
(appq.Recurrence.GetType() ==
typeof
(Microsoft.Exchange.WebServices.Data.Recurrence.MonthlyPattern) || appq.Recurrence.GetType() ==
typeof
(Microsoft.Exchange.WebServices.Data.Recurrence.MonthlyRegenerationPattern))
{
var monthpattern = (Microsoft.Exchange.WebServices.Data.Recurrence.MonthlyPattern)appq.Recurrence;
schedulerPattern.Frequency = RecurrenceFrequency.Monthly;
schedulerPattern.Interval = interval;
schedulerPattern.DayOfMonth = monthpattern.DayOfMonth;
}
else
if
(appq.Recurrence.GetType() ==
typeof
(Microsoft.Exchange.WebServices.Data.Recurrence.RelativeMonthlyPattern))
{
var monthpattern = (Microsoft.Exchange.WebServices.Data.Recurrence.RelativeMonthlyPattern)appq.Recurrence;
schedulerPattern.Frequency = RecurrenceFrequency.Monthly;
schedulerPattern.Interval = interval;
schedulerPattern.DaysOfWeekMask = GetDayOfWeekMask(monthpattern.DayOfTheWeek);
schedulerPattern.DayOrdinal = GetDayOfTheWeekIndex(monthpattern.DayOfTheWeekIndex);
}
else
if
(appq.Recurrence.GetType() ==
typeof
(Microsoft.Exchange.WebServices.Data.Recurrence.YearlyPattern) || appq.Recurrence.GetType() ==
typeof
(Microsoft.Exchange.WebServices.Data.Recurrence.YearlyRegenerationPattern))
{
var yearpattern = (Microsoft.Exchange.WebServices.Data.Recurrence.YearlyPattern)appq.Recurrence;
schedulerPattern.Frequency = RecurrenceFrequency.Yearly;
schedulerPattern.DayOfMonth = yearpattern.DayOfMonth;
schedulerPattern.Month = GetRecurrenceMonth(yearpattern.Month);
}
else
if
(appq.Recurrence.GetType() ==
typeof
(Microsoft.Exchange.WebServices.Data.Recurrence.RelativeYearlyPattern))
{
var yearpattern = (Microsoft.Exchange.WebServices.Data.Recurrence.RelativeYearlyPattern)appq.Recurrence;
schedulerPattern.Frequency = RecurrenceFrequency.Yearly;
schedulerPattern.DaysOfWeekMask = GetDayOfWeekMask(yearpattern.DayOfTheWeek);
schedulerPattern.DayOrdinal = GetDayOfTheWeekIndex(yearpattern.DayOfTheWeekIndex);
schedulerPattern.Month = GetRecurrenceMonth(yearpattern.Month);
}
var rrule = RecurrenceRule.FromPatternAndRange(schedulerPattern, schedulerRange);
if
(appq.ModifiedOccurrences !=
null
)
{
foreach
(var item
in
appq.ModifiedOccurrences)
{
rrule.Exceptions.Add(
new
DateTime(Convert.ToInt32(item.OriginalStart.Year), Convert.ToInt32(item.OriginalStart.Month), Convert.ToInt32(item.OriginalStart.Day), Convert.ToInt32(item.OriginalStart.Hour), Convert.ToInt32(item.OriginalStart.Minute), Convert.ToInt32(item.OriginalStart.Second)).ToLocalTime());
}
}
if
(appq.DeletedOccurrences ==
null
)
return
rrule;
foreach
(var item
in
appq.DeletedOccurrences)
{
rrule.Exceptions.Add(
new
DateTime(Convert.ToInt32(item.OriginalStart.Year), Convert.ToInt32(item.OriginalStart.Month), Convert.ToInt32(item.OriginalStart.Day), Convert.ToInt32(item.OriginalStart.Hour), Convert.ToInt32(item.OriginalStart.Minute), Convert.ToInt32(item.OriginalStart.Second)).ToLocalTime());
}
return
rrule;
}
return
null
;
}
Please help us in this URGENT as we need to fix today.