public static void Run() { // ExStart:SendMeetingRequestsUsingEWS try { // Create instance of IEWSClient class by giving credentials IEWSClient client = EWSClient.GetEWSClient("https://outlook.office365.com/ews/exchange.asmx", "testUser", "pwd", "domain"); // create the meeting request Appointment app = new Appointment("meeting request", DateTime.Now.AddHours(1), DateTime.Now.AddHours(1.5), "*****@*****.**", "*****@*****.**"); app.Summary = "meeting request summary"; app.Description = "description"; // set recurrence pattern for this appointment RecurrencePattern pattern = new DailyRecurrencePattern(DateTime.Now.AddDays(5)); app.RecurrencePattern = pattern; // create the message and set the meeting request MailMessage msg = new MailMessage(); msg.From = "*****@*****.**"; msg.To = "*****@*****.**"; msg.IsBodyHtml = true; msg.HtmlBody = "<h3>HTML Heading</h3><p>Email Message detail</p>"; msg.Subject = "meeting request"; msg.AddAlternateView(app.RequestApointment(0)); // send the appointment client.Send(msg); Console.WriteLine("Appointment request sent"); } catch (Exception ex) { Console.WriteLine(ex.Message); } // ExEnd:SendMeetingRequestsUsingEWS }
public DailyRecurrencePattern ConvertEntitiesToStorage(DailyRecurrencePattern value) { if (value != null) { return(new DailyRecurrencePattern(value.Interval)); } return(null); }
// Token: 0x06001219 RID: 4633 RVA: 0x000624FC File Offset: 0x000606FC private static void PopulateRecurrencePattern(RecurrenceData recurrenceData, RecurrencePattern pattern) { recurrenceData.Interval = (ushort)pattern.Interval; DailyRecurrencePattern dailyRecurrencePattern = pattern as DailyRecurrencePattern; if (dailyRecurrencePattern != null) { recurrenceData.Type = RecurrenceData.RecurrenceType.Daily; return; } WeeklyRecurrencePattern weeklyRecurrencePattern = pattern as WeeklyRecurrencePattern; if (weeklyRecurrencePattern != null) { recurrenceData.Type = RecurrenceData.RecurrenceType.Weekly; recurrenceData.DaysOfWeek = weeklyRecurrencePattern.DaysOfWeek; return; } AbsoluteMonthlyRecurrencePattern absoluteMonthlyRecurrencePattern = pattern as AbsoluteMonthlyRecurrencePattern; if (absoluteMonthlyRecurrencePattern != null) { recurrenceData.Type = RecurrenceData.RecurrenceType.Monthly; recurrenceData.DayOfMonth = (byte)absoluteMonthlyRecurrencePattern.DayOfMonth; return; } RelativeMonthlyRecurrencePattern relativeMonthlyRecurrencePattern = pattern as RelativeMonthlyRecurrencePattern; if (relativeMonthlyRecurrencePattern != null) { recurrenceData.Type = RecurrenceData.RecurrenceType.MonthlyTh; recurrenceData.WeekIndex = relativeMonthlyRecurrencePattern.Index; recurrenceData.DaysOfWeek = relativeMonthlyRecurrencePattern.DaysOfWeek; return; } AbsoluteYearlyRecurrencePattern absoluteYearlyRecurrencePattern = pattern as AbsoluteYearlyRecurrencePattern; if (absoluteYearlyRecurrencePattern != null) { recurrenceData.Type = RecurrenceData.RecurrenceType.Yearly; recurrenceData.DayOfMonth = (byte)absoluteYearlyRecurrencePattern.DayOfMonth; recurrenceData.MonthOfYear = (byte)absoluteYearlyRecurrencePattern.Month; return; } RelativeYearlyRecurrencePattern relativeYearlyRecurrencePattern = pattern as RelativeYearlyRecurrencePattern; if (relativeYearlyRecurrencePattern != null) { recurrenceData.Type = RecurrenceData.RecurrenceType.YearlyTh; recurrenceData.WeekIndex = relativeYearlyRecurrencePattern.Index; recurrenceData.DaysOfWeek = relativeYearlyRecurrencePattern.DaysOfWeek; recurrenceData.MonthOfYear = (byte)relativeYearlyRecurrencePattern.Month; return; } throw new ConversionException("Unexpected Recurrence Pattern"); }
public RecurrencePattern ConvertStorageToEntities(DailyRecurrencePattern value) { if (value != null) { return(new DailyRecurrencePattern { Interval = value.RecurrenceInterval }); } return(null); }
// Token: 0x06001217 RID: 4631 RVA: 0x000622F8 File Offset: 0x000604F8 private static RecurrencePattern CreateRecurrencePattern(RecurrenceData recurrenceData) { RecurrencePattern recurrencePattern; switch (recurrenceData.Type) { case RecurrenceData.RecurrenceType.Daily: if (recurrenceData.SubProperties["DayOfWeek"] != null) { recurrencePattern = new WeeklyRecurrencePattern(); ((WeeklyRecurrencePattern)recurrencePattern).DaysOfWeek = recurrenceData.DaysOfWeek; goto IL_15E; } recurrencePattern = new DailyRecurrencePattern(); goto IL_15E; case RecurrenceData.RecurrenceType.Weekly: recurrencePattern = new WeeklyRecurrencePattern(); ((WeeklyRecurrencePattern)recurrencePattern).DaysOfWeek = recurrenceData.DaysOfWeek; goto IL_15E; case RecurrenceData.RecurrenceType.Monthly: recurrencePattern = new AbsoluteMonthlyRecurrencePattern(); ((AbsoluteMonthlyRecurrencePattern)recurrencePattern).DayOfMonth = (int)recurrenceData.DayOfMonth; goto IL_15E; case RecurrenceData.RecurrenceType.MonthlyTh: recurrencePattern = new RelativeMonthlyRecurrencePattern(); ((RelativeMonthlyRecurrencePattern)recurrencePattern).DaysOfWeek = recurrenceData.DaysOfWeek; ((RelativeMonthlyRecurrencePattern)recurrencePattern).Index = recurrenceData.WeekIndex; goto IL_15E; case RecurrenceData.RecurrenceType.Yearly: recurrencePattern = new AbsoluteYearlyRecurrencePattern(); ((AbsoluteYearlyRecurrencePattern)recurrencePattern).DayOfMonth = (int)recurrenceData.DayOfMonth; ((AbsoluteYearlyRecurrencePattern)recurrencePattern).Month = (int)recurrenceData.MonthOfYear; goto IL_15E; case RecurrenceData.RecurrenceType.YearlyTh: recurrencePattern = new RelativeYearlyRecurrencePattern(); ((RelativeYearlyRecurrencePattern)recurrencePattern).DaysOfWeek = recurrenceData.DaysOfWeek; ((RelativeYearlyRecurrencePattern)recurrencePattern).Index = recurrenceData.WeekIndex; ((RelativeYearlyRecurrencePattern)recurrencePattern).Month = (int)recurrenceData.MonthOfYear; goto IL_15E; } throw new ConversionException(string.Format(CultureInfo.InvariantCulture, "Unexpected recurrence type {0}, should have been caught in a higher validation layer", new object[] { recurrenceData.Type })); IL_15E: recurrencePattern.Interval = (int)(recurrenceData.HasInterval() ? recurrenceData.Interval : 1); return(recurrencePattern); }
public static bool IsRecurrencePatternEqual(RecurrencePattern p1, RecurrencePattern p2) { if (p1 == null != (p2 == null)) { return(false); } if (p1 != null) { if (!p1.GetType().Equals(p2.GetType())) { return(false); } DailyRecurrencePattern dailyRecurrencePattern = p1 as DailyRecurrencePattern; if (dailyRecurrencePattern != null) { DailyRecurrencePattern dailyRecurrencePattern2 = p2 as DailyRecurrencePattern; return(dailyRecurrencePattern.RecurrenceInterval == dailyRecurrencePattern2.RecurrenceInterval); } WeeklyRecurrencePattern weeklyRecurrencePattern = p1 as WeeklyRecurrencePattern; if (weeklyRecurrencePattern != null) { WeeklyRecurrencePattern weeklyRecurrencePattern2 = p2 as WeeklyRecurrencePattern; return(weeklyRecurrencePattern.DaysOfWeek == weeklyRecurrencePattern2.DaysOfWeek && weeklyRecurrencePattern.FirstDayOfWeek == weeklyRecurrencePattern2.FirstDayOfWeek && weeklyRecurrencePattern.RecurrenceInterval == weeklyRecurrencePattern2.RecurrenceInterval); } MonthlyRecurrencePattern monthlyRecurrencePattern = p1 as MonthlyRecurrencePattern; if (monthlyRecurrencePattern != null) { MonthlyRecurrencePattern monthlyRecurrencePattern2 = p2 as MonthlyRecurrencePattern; return(monthlyRecurrencePattern.CalendarType == monthlyRecurrencePattern2.CalendarType && monthlyRecurrencePattern.DayOfMonth == monthlyRecurrencePattern2.DayOfMonth && monthlyRecurrencePattern.RecurrenceInterval == monthlyRecurrencePattern2.RecurrenceInterval); } MonthlyThRecurrencePattern monthlyThRecurrencePattern = p1 as MonthlyThRecurrencePattern; if (monthlyThRecurrencePattern != null) { MonthlyThRecurrencePattern monthlyThRecurrencePattern2 = p2 as MonthlyThRecurrencePattern; return(monthlyThRecurrencePattern.CalendarType == monthlyThRecurrencePattern2.CalendarType && monthlyThRecurrencePattern.DaysOfWeek == monthlyThRecurrencePattern2.DaysOfWeek && monthlyThRecurrencePattern.Order == monthlyThRecurrencePattern2.Order && monthlyThRecurrencePattern.RecurrenceInterval == monthlyThRecurrencePattern2.RecurrenceInterval); } YearlyRecurrencePattern yearlyRecurrencePattern = p1 as YearlyRecurrencePattern; if (yearlyRecurrencePattern != null) { YearlyRecurrencePattern yearlyRecurrencePattern2 = p2 as YearlyRecurrencePattern; return(yearlyRecurrencePattern.CalendarType == yearlyRecurrencePattern2.CalendarType && yearlyRecurrencePattern.DayOfMonth == yearlyRecurrencePattern2.DayOfMonth && yearlyRecurrencePattern.IsLeapMonth == yearlyRecurrencePattern2.IsLeapMonth && yearlyRecurrencePattern.Month == yearlyRecurrencePattern2.Month); } YearlyThRecurrencePattern yearlyThRecurrencePattern = p1 as YearlyThRecurrencePattern; if (yearlyThRecurrencePattern != null) { YearlyThRecurrencePattern yearlyThRecurrencePattern2 = p2 as YearlyThRecurrencePattern; return(yearlyThRecurrencePattern.CalendarType == yearlyThRecurrencePattern2.CalendarType && yearlyThRecurrencePattern.DaysOfWeek == yearlyThRecurrencePattern2.DaysOfWeek && yearlyThRecurrencePattern.IsLeapMonth == yearlyThRecurrencePattern2.IsLeapMonth && yearlyThRecurrencePattern.Month == yearlyThRecurrencePattern2.Month && yearlyThRecurrencePattern.Order == yearlyThRecurrencePattern2.Order); } } return(true); }
public RecurrencePattern Convert(RecurrencePattern value) { if (value == null) { return(null); } DailyRecurrencePattern dailyRecurrencePattern = value as DailyRecurrencePattern; if (dailyRecurrencePattern != null) { return(PatternConverter.dailyPatternConverter.ConvertStorageToEntities(dailyRecurrencePattern)); } WeeklyRecurrencePattern weeklyRecurrencePattern = value as WeeklyRecurrencePattern; if (weeklyRecurrencePattern != null) { return(PatternConverter.weeklyPatternConverter.ConvertStorageToEntities(weeklyRecurrencePattern)); } MonthlyRecurrencePattern monthlyRecurrencePattern = value as MonthlyRecurrencePattern; if (monthlyRecurrencePattern != null) { return(PatternConverter.monthlyPatternConverter.ConvertStorageToEntities(monthlyRecurrencePattern)); } MonthlyThRecurrencePattern monthlyThRecurrencePattern = value as MonthlyThRecurrencePattern; if (monthlyThRecurrencePattern != null) { return(PatternConverter.monthlyPatternConverter.ConvertStorageToEntities(monthlyThRecurrencePattern)); } YearlyRecurrencePattern yearlyRecurrencePattern = value as YearlyRecurrencePattern; if (yearlyRecurrencePattern != null) { return(PatternConverter.yearlyPatternConverter.ConvertStorageToEntities(yearlyRecurrencePattern)); } YearlyThRecurrencePattern yearlyThRecurrencePattern = value as YearlyThRecurrencePattern; if (yearlyThRecurrencePattern != null) { return(PatternConverter.yearlyPatternConverter.ConvertStorageToEntities(yearlyThRecurrencePattern)); } if (value is DailyRegeneratingPattern || value is WeeklyRegeneratingPattern || value is MonthlyRegeneratingPattern || value is YearlyRegeneratingPattern) { throw new NotImplementedException("Regenerating tasks are not implemented in Entities yet."); } throw new ArgumentValueCannotBeParsedException("value", value.GetType().FullName, typeof(RecurrencePattern).FullName); }
public static RecurrencePattern CloneRecurrencePattern(RecurrencePattern pattern) { RecurrencePattern result = null; if (pattern == null) { return(result); } DailyRecurrencePattern dailyRecurrencePattern = pattern as DailyRecurrencePattern; if (dailyRecurrencePattern != null) { return(new DailyRecurrencePattern(dailyRecurrencePattern.RecurrenceInterval)); } MonthlyRecurrencePattern monthlyRecurrencePattern = pattern as MonthlyRecurrencePattern; if (monthlyRecurrencePattern != null) { return(new MonthlyRecurrencePattern(monthlyRecurrencePattern.DayOfMonth, monthlyRecurrencePattern.RecurrenceInterval, monthlyRecurrencePattern.CalendarType)); } MonthlyThRecurrencePattern monthlyThRecurrencePattern = pattern as MonthlyThRecurrencePattern; if (monthlyThRecurrencePattern != null) { return(new MonthlyThRecurrencePattern(monthlyThRecurrencePattern.DaysOfWeek, monthlyThRecurrencePattern.Order, monthlyThRecurrencePattern.RecurrenceInterval, monthlyThRecurrencePattern.CalendarType)); } WeeklyRecurrencePattern weeklyRecurrencePattern = pattern as WeeklyRecurrencePattern; if (weeklyRecurrencePattern != null) { return(new WeeklyRecurrencePattern(weeklyRecurrencePattern.DaysOfWeek, weeklyRecurrencePattern.RecurrenceInterval, weeklyRecurrencePattern.FirstDayOfWeek)); } YearlyRecurrencePattern yearlyRecurrencePattern = pattern as YearlyRecurrencePattern; if (yearlyRecurrencePattern != null) { return(new YearlyRecurrencePattern(yearlyRecurrencePattern.DayOfMonth, yearlyRecurrencePattern.Month, yearlyRecurrencePattern.IsLeapMonth, yearlyRecurrencePattern.CalendarType)); } YearlyThRecurrencePattern yearlyThRecurrencePattern = pattern as YearlyThRecurrencePattern; if (yearlyThRecurrencePattern != null) { return(new YearlyThRecurrencePattern(yearlyThRecurrencePattern.DaysOfWeek, yearlyThRecurrencePattern.Order, yearlyThRecurrencePattern.Month, yearlyThRecurrencePattern.IsLeapMonth, yearlyThRecurrencePattern.CalendarType)); } throw new ArgumentException("Unhandled RecurrencePattern type."); }
protected Recurrence CreateRecurrenceFromRequest() { Recurrence result = null; if (base.IsParameterSet("RcrT")) { OwaRecurrenceType owaRecurrenceType = (OwaRecurrenceType)base.GetParameter("RcrT"); RecurrencePattern recurrencePattern = null; OwaRecurrenceType owaRecurrenceType2 = owaRecurrenceType; if (owaRecurrenceType2 <= (OwaRecurrenceType.Monthly | OwaRecurrenceType.MonthlyTh)) { if (owaRecurrenceType2 <= OwaRecurrenceType.Monthly) { switch (owaRecurrenceType2) { case OwaRecurrenceType.Daily: recurrencePattern = new DailyRecurrencePattern((int)base.GetParameter("RcrI")); break; case OwaRecurrenceType.None | OwaRecurrenceType.Daily: break; case OwaRecurrenceType.Weekly: recurrencePattern = new WeeklyRecurrencePattern((DaysOfWeek)base.GetParameter("RcrDys"), (int)base.GetParameter("RcrI")); break; default: if (owaRecurrenceType2 == OwaRecurrenceType.Monthly) { recurrencePattern = new MonthlyRecurrencePattern((int)base.GetParameter("RcrDy"), (int)base.GetParameter("RcrI")); } break; } } else if (owaRecurrenceType2 != OwaRecurrenceType.Yearly) { if (owaRecurrenceType2 != (OwaRecurrenceType.Daily | OwaRecurrenceType.DailyEveryWeekday)) { if (owaRecurrenceType2 == (OwaRecurrenceType.Monthly | OwaRecurrenceType.MonthlyTh)) { recurrencePattern = new MonthlyThRecurrencePattern((DaysOfWeek)base.GetParameter("RcrDys"), (RecurrenceOrderType)base.GetParameter("RcrO"), (int)base.GetParameter("RcrI")); } } else { recurrencePattern = new WeeklyRecurrencePattern(DaysOfWeek.Weekdays); } } else { recurrencePattern = new YearlyRecurrencePattern((int)base.GetParameter("RcrDy"), (int)base.GetParameter("RcrM")); } } else if (owaRecurrenceType2 <= (OwaRecurrenceType.Daily | OwaRecurrenceType.DailyRegenerating)) { if (owaRecurrenceType2 != (OwaRecurrenceType.Yearly | OwaRecurrenceType.YearlyTh)) { if (owaRecurrenceType2 == (OwaRecurrenceType.Daily | OwaRecurrenceType.DailyRegenerating)) { recurrencePattern = new DailyRegeneratingPattern((int)base.GetParameter("RgrI")); } } else { recurrencePattern = new YearlyThRecurrencePattern((DaysOfWeek)base.GetParameter("RcrDys"), (RecurrenceOrderType)base.GetParameter("RcrO"), (int)base.GetParameter("RcrM")); } } else if (owaRecurrenceType2 != (OwaRecurrenceType.Weekly | OwaRecurrenceType.WeeklyRegenerating)) { if (owaRecurrenceType2 != (OwaRecurrenceType.Monthly | OwaRecurrenceType.MonthlyRegenerating)) { if (owaRecurrenceType2 == (OwaRecurrenceType.Yearly | OwaRecurrenceType.YearlyRegenerating)) { recurrencePattern = new YearlyRegeneratingPattern((int)base.GetParameter("RgrI")); } } else { recurrencePattern = new MonthlyRegeneratingPattern((int)base.GetParameter("RgrI")); } } else { recurrencePattern = new WeeklyRegeneratingPattern((int)base.GetParameter("RgrI")); } if (owaRecurrenceType != OwaRecurrenceType.None) { RecurrenceRangeType recurrenceRangeType = (RecurrenceRangeType)base.GetParameter("RcrRngT"); ExDateTime startDate = (ExDateTime)base.GetParameter("RcrRngS"); RecurrenceRange recurrenceRange; switch (recurrenceRangeType) { case RecurrenceRangeType.Numbered: recurrenceRange = new NumberedRecurrenceRange(startDate, (int)base.GetParameter("RcrRngO")); goto IL_2C8; case RecurrenceRangeType.EndDate: recurrenceRange = new EndDateRecurrenceRange(startDate, (ExDateTime)base.GetParameter("RcrRngE")); goto IL_2C8; } recurrenceRange = new NoEndRecurrenceRange(startDate); IL_2C8: if (recurrencePattern != null && recurrenceRange != null) { result = new Recurrence(recurrencePattern, recurrenceRange); } } } return(result); }
// Token: 0x060001CB RID: 459 RVA: 0x00011324 File Offset: 0x0000F524 private static Recurrence CreateRecurrenceFromRequest(HttpRequest request, ExDateTime startDate, UserContext userContext) { OwaRecurrenceType newRecurrenceTypeFromPost = EditRecurrencePreFormAction.GetNewRecurrenceTypeFromPost(request); RecurrencePattern pattern = null; Recurrence result = null; DaysOfWeek defaultDaysOfWeek = CalendarUtilities.ConvertDateTimeToDaysOfWeek(startDate); int defaultValue = CalendarUtilities.ComputeDayOfMonthOrder(startDate); OwaRecurrenceType owaRecurrenceType = newRecurrenceTypeFromPost; if (owaRecurrenceType <= OwaRecurrenceType.Yearly) { switch (owaRecurrenceType) { case OwaRecurrenceType.Daily: { int num = EditRecurrencePreFormAction.GetIntFormParameter(request, "txtinterval", 1); num = Math.Max(1, num); pattern = new DailyRecurrencePattern(num); break; } case OwaRecurrenceType.None | OwaRecurrenceType.Daily: break; case OwaRecurrenceType.Weekly: { int num = EditRecurrencePreFormAction.GetIntFormParameter(request, "txtinterval", 1); num = Math.Max(1, num); pattern = new WeeklyRecurrencePattern(EditRecurrencePreFormAction.ParseDayCheckboxes(request, defaultDaysOfWeek), num); break; } default: if (owaRecurrenceType != OwaRecurrenceType.Monthly) { if (owaRecurrenceType == OwaRecurrenceType.Yearly) { int num2 = EditRecurrencePreFormAction.GetIntFormParameter(request, "selRcrYD", startDate.Day); int intFormParameter = EditRecurrencePreFormAction.GetIntFormParameter(request, "selRcrYM", startDate.Month); num2 = Math.Min(ExDateTime.DaysInMonth(startDate.Year, intFormParameter), num2); pattern = new YearlyRecurrencePattern(num2, intFormParameter); } } else { int num2 = EditRecurrencePreFormAction.GetIntFormParameter(request, "txtRcrMD", startDate.Day); int num = EditRecurrencePreFormAction.GetIntFormParameter(request, "txtRcrMM", 1); num = Math.Max(1, num); pattern = new MonthlyRecurrencePattern(num2, num); } break; } } else if (owaRecurrenceType != (OwaRecurrenceType.Daily | OwaRecurrenceType.DailyEveryWeekday)) { if (owaRecurrenceType != (OwaRecurrenceType.Monthly | OwaRecurrenceType.MonthlyTh)) { if (owaRecurrenceType == (OwaRecurrenceType.Yearly | OwaRecurrenceType.YearlyTh)) { int intFormParameter2 = EditRecurrencePreFormAction.GetIntFormParameter(request, "selRcrYTI", defaultValue); int intFormParameter = EditRecurrencePreFormAction.GetIntFormParameter(request, "selRcrYTM", startDate.Month); DaysOfWeek daysOfWeek = EditRecurrencePreFormAction.ParseDaysOfWeek(request, "selRcrThD", defaultDaysOfWeek); pattern = new YearlyThRecurrencePattern(daysOfWeek, (RecurrenceOrderType)intFormParameter2, intFormParameter); } } else { int intFormParameter2 = EditRecurrencePreFormAction.GetIntFormParameter(request, "selRcrYTI", defaultValue); int num = EditRecurrencePreFormAction.GetIntFormParameter(request, "txtRcrMThM", 1); num = Math.Max(1, num); DaysOfWeek daysOfWeek = EditRecurrencePreFormAction.ParseDaysOfWeek(request, "selRcrThD", defaultDaysOfWeek); pattern = new MonthlyThRecurrencePattern(daysOfWeek, (RecurrenceOrderType)intFormParameter2, num); } } else { pattern = new WeeklyRecurrencePattern(DaysOfWeek.Weekdays); } if (newRecurrenceTypeFromPost != OwaRecurrenceType.None) { if (startDate == ExDateTime.MinValue) { startDate = CalendarUtilities.ParseDateTimeFromForm(request, "selSY", "selSM", "selSD", null, userContext); } RecurrenceRange range; switch (EditRecurrencePreFormAction.GetRecurrenceRangeTypeFromPost(request)) { case RecurrenceRangeType.Numbered: { int num3 = EditRecurrencePreFormAction.GetIntFormParameter(request, "txtno", 10); num3 = Math.Max(1, num3); range = new NumberedRecurrenceRange(startDate, num3); goto IL_284; } case RecurrenceRangeType.EndDate: { ExDateTime exDateTime = CalendarUtilities.ParseDateTimeFromForm(request, "selEY", "selEM", "selED", null, userContext); if (exDateTime < startDate) { exDateTime = startDate.IncrementDays(10); } range = new EndDateRecurrenceRange(startDate, exDateTime); goto IL_284; } } range = new NoEndRecurrenceRange(startDate); IL_284: result = new Recurrence(pattern, range); } return(result); }
public static Microsoft.Exchange.Connections.Eas.Model.Request.Calendar.Recurrence GetRecurrenceData(PatternedRecurrence recurrence) { if (recurrence == null) { return(null); } Microsoft.Exchange.Connections.Eas.Model.Request.Calendar.Recurrence recurrence2 = new Microsoft.Exchange.Connections.Eas.Model.Request.Calendar.Recurrence(); recurrence2.Interval = new ushort?((ushort)recurrence.Pattern.Interval); RecurrencePatternType type = recurrence.Pattern.Type; switch (type) { case RecurrencePatternType.Daily: { DailyRecurrencePattern dailyRecurrencePattern = (DailyRecurrencePattern)recurrence.Pattern; recurrence2.Type = 0; break; } case RecurrencePatternType.Weekly: { WeeklyRecurrencePattern weeklyRecurrencePattern = (WeeklyRecurrencePattern)recurrence.Pattern; recurrence2.Type = 1; recurrence2.DayOfWeek = new ushort?(SyncCalendarUtils.GetDayOfWeekValue(weeklyRecurrencePattern.DaysOfWeek)); break; } case RecurrencePatternType.AbsoluteMonthly: { AbsoluteMonthlyRecurrencePattern absoluteMonthlyRecurrencePattern = (AbsoluteMonthlyRecurrencePattern)recurrence.Pattern; recurrence2.Type = 2; recurrence2.DayOfMonth = new byte?((byte)absoluteMonthlyRecurrencePattern.DayOfMonth); break; } case RecurrencePatternType.RelativeMonthly: { RelativeMonthlyRecurrencePattern relativeMonthlyRecurrencePattern = (RelativeMonthlyRecurrencePattern)recurrence.Pattern; recurrence2.Type = 3; recurrence2.DayOfWeek = new ushort?(SyncCalendarUtils.GetDayOfWeekValue(relativeMonthlyRecurrencePattern.DaysOfWeek)); recurrence2.WeekOfMonth = new byte?((byte)relativeMonthlyRecurrencePattern.Index); break; } case RecurrencePatternType.AbsoluteYearly: { AbsoluteYearlyRecurrencePattern absoluteYearlyRecurrencePattern = (AbsoluteYearlyRecurrencePattern)recurrence.Pattern; recurrence2.Type = 5; recurrence2.DayOfMonth = new byte?((byte)absoluteYearlyRecurrencePattern.DayOfMonth); recurrence2.MonthOfYear = new byte?((byte)absoluteYearlyRecurrencePattern.Month); break; } case RecurrencePatternType.RelativeYearly: { RelativeYearlyRecurrencePattern relativeYearlyRecurrencePattern = (RelativeYearlyRecurrencePattern)recurrence.Pattern; recurrence2.Type = 6; recurrence2.DayOfWeek = new ushort?(SyncCalendarUtils.GetDayOfWeekValue(relativeYearlyRecurrencePattern.DaysOfWeek)); recurrence2.WeekOfMonth = new byte?((byte)relativeYearlyRecurrencePattern.Index); recurrence2.MonthOfYear = new byte?((byte)relativeYearlyRecurrencePattern.Month); break; } default: throw new EasSyncFailedPermanentException("Invalid recurrence type: " + type); } RecurrenceRangeType type2 = recurrence.Range.Type; switch (type2) { case RecurrenceRangeType.EndDate: { EndDateRecurrenceRange endDateRecurrenceRange = (EndDateRecurrenceRange)recurrence.Range; recurrence2.Until = SyncCalendarUtils.ToStringDateTime(endDateRecurrenceRange.EndDate); break; } case RecurrenceRangeType.NoEnd: break; case RecurrenceRangeType.Numbered: { NumberedRecurrenceRange numberedRecurrenceRange = (NumberedRecurrenceRange)recurrence.Range; recurrence2.Occurrences = new ushort?((ushort)numberedRecurrenceRange.NumberOfOccurrences); break; } default: throw new EasSyncFailedPermanentException("Invalid recurrence range type: {0}" + type2); } return(recurrence2); }