We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to parse the RecurrenceRule in server side?

Platform: ASP.NET Web Forms |
Control: Schedule |
Published Date: August 26, 2015 |
Last Revised Date: January 3, 2020 |
.NET Framework: 4.5

You can parse the RecurrenceRule of an appointment from the server-side by making use of a new generic utility class RecurrenceHelper. Within this utility class, GetRecurrenceDateTimeCollection method is defined that generates the date instances based on the RecurrenceRule and recurrence start date of the appointment.

You can find the complete class definition of RecurrenceHelper utility in RecurrenceHelper.cs file and can refer to it in any of the application that is available along with the following sample link.

By referring to the above helper class in your sample project, you can make use of the GetRecurrenceDateTimeCollection method by passing the RecurrenceRule and start date of the recurrence appointment, which automatically generates the date instances as a result.

For example, refer to the following code examples that makes use of the method defined within the RecurrenceHelper class.

Program.cs

class Program
    {
        static void Main(string[] args)
        {
            List<DateTime> dates = new List<DateTime>();
            var RecurrenceRule = "FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR;COUNT=10;EXDATE=04/08/2015,06/08/2015";
            //Pass the recurrencerule string and the start date of the appointment to this method that returns the dates collection based on the recurrence rule
            dates = RecurrenceHelper.GetRecurrenceDateTimeCollection(RecurrenceRule, DateTime.Now.Date).ToList();
            // Now, the variable “dates” contains the date collection, with that the appointment instances can be created manually.
            foreach (DateTime dt in dates)
            {
                Console.WriteLine(dt.Date.ToString());
            }
            Console.ReadKey();
        }
    }

Sample Link

https://www.syncfusion.com/downloads/support/directtrac/general/ze/ScheduleRecurrenceHelper-16777999471340759250

 

2X faster development

The ultimate ASP.NET Web Forms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment
Comments
Philippe-Antoine Major
Oct 17, 2019

Where can we find the referenced RecurrenceHelper ? The demo project cannot be downloaded (access denied even if logged in)

Reply
Balasubramanian Sattanathan [Syncfusion]
Oct 18, 2019

Hi Philippe-Antoine,

Thanks for your update.

Yes, we can refer the Recurrence helper from the below GitHub links.

Links : https://github.com/SyncfusionExamples/how-to-parse-recurrence-rule-at-server-side/blob/master/Parse_Recurrece_Rule/ScheduleSample/Models/RecurrenceHelper.cs https://github.com/SyncfusionExamples/ej2-scheduler-recurrence-helper

Regards,

Balasubramanian S

Reply

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon