none
Create appointemnent with recurrence RRS feed

  • Question

  • Hi,

    I have another question regarding the syntax for creating reccuring calendar events using EWS (non managed apis).

    I have different scenario that I do not manage to code:

    1. example : 5 occurences of a weekly appointement, every tuesday.

    CalendarItemType appointment = new CalendarItemType();
    appointment.IsRecurringSpecified = true;    
    [...]
    NumberedRecurrenceRangeType recurrenceRange = new NumberedRecurrenceRangeType();
    recurrenceRange.StartDate = start;
    recurrenceRange.NumberOfOccurrences = count;
    appointment.Recurrence.Item1 = recurrenceRange;
    
    WeeklyRecurrencePatternType recurrencePattern = new WeeklyRecurrencePatternType();
    recurrencePattern.Interval = interval;
    recurrencePattern.DaysOfWeek = "Tuesday";
    appointment.Recurrence.Item = recurrencePattern;  

    In return, I have the error:

    The element 'Recurrence' in namespace 'http://schemas.microsoft.com/exchange/services/2006/types' 
    has invalid child element 'NumberedRecurrence' [...]
    List of possible elements expected: 
    RelativeYearlyRecurrence, 
    AbsoluteYearlyRecurrence, 
    RelativeMonthlyRecurrence, 
    AbsoluteMonthlyRecurrence, 
    WeeklyRecurrence, 
    DailyRecurrence' 

    It looks like NumberedRecurrenceRangeType is invalid.

    2.  I have the same problem with monthly recurrences:MonthlyRegeneratingPatternType 

    recurrencePattern = new MonthlyRegeneratingPatternType();
    recurrencePattern.Interval = interval;
    appointment.Recurrence.Item = recurrencePattern;

    Question:

    How can I code these 2 scenarios?

    Thanks in advance for your propositions.


    Cordialement,
    Emmanuel Dreux,

    http://www.cloudiway.com


    • Edited by ilinfo Friday, August 17, 2012 12:39 PM
    Friday, August 17, 2012 12:38 PM

Answers

  • MonthlyRegeneratingPatternType is for Tasks so you should be using this.

    NumberedRecurrenceRangeType should work okay I can't see anything wrong with your sample but as a test i would try the sample out of http://msdn.microsoft.com/en-us/library/exchange/bb738399%28v=exchg.80%29.aspx as there maybe typo or syntax issue in the code you haven't posted.

    You might want to check the server you generated the Proxies against eg if your developing against a RTM 2007 server then you going to have a problems. You want to at least have 2007 SP1 with RU4.

    Cheers
    Glen

    • Marked as answer by ilinfo Monday, August 20, 2012 2:35 PM
    Monday, August 20, 2012 7:26 AM

All replies

  • MonthlyRegeneratingPatternType is for Tasks so you should be using this.

    NumberedRecurrenceRangeType should work okay I can't see anything wrong with your sample but as a test i would try the sample out of http://msdn.microsoft.com/en-us/library/exchange/bb738399%28v=exchg.80%29.aspx as there maybe typo or syntax issue in the code you haven't posted.

    You might want to check the server you generated the Proxies against eg if your developing against a RTM 2007 server then you going to have a problems. You want to at least have 2007 SP1 with RU4.

    Cheers
    Glen

    • Marked as answer by ilinfo Monday, August 20, 2012 2:35 PM
    Monday, August 20, 2012 7:26 AM
  • The sample works.

    I will check my code,

    Thanks.

    Note: When I run the sample code, it tells me that MeetingTimeZone is deprecated.

            I replaced the following code by:

        

      //// Construct a TimeZoneType that will be used to set the MeetingTimeZone
    
                //// of the new recurring CalendarItem.
                //TimeZoneType tzUSMST = new TimeZoneType();
                //tzUSMST.BaseOffset = "PT7H";
                //newCalendarItem.MeetingTimeZone = tzUSMST;

             
       TimeZoneDefinitionType tz = new TimeZoneDefinitionType();
                tz.Id = GetTimezoneID();
                newCalendarItem.StartTimeZone = tz;
                newCalendarItem.EndTimeZone = tz;     
    
    
    
     private string GetTimezoneID()
            {
                ReadOnlyCollection<TimeZoneInfo> timeZones = TimeZoneInfo.GetSystemTimeZones();
                string currenttimezone = TimeZone.CurrentTimeZone.StandardName;
                foreach (TimeZoneInfo timeZone in timeZones)
                {
                    if (string.Compare(timeZone.StandardName, currenttimezone, true) == 0)
                    {
                        return timeZone.Id;
                    }
                }
                return string.Empty;
            }

    Quite ugly, but it works!


    Cordialement,
    Emmanuel Dreux
    http://www.cloudiway.com

    Monday, August 20, 2012 2:35 PM