How to parse the RecurrenceRule in server side in ASP.NET MVC Scheduler?
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
Conclusion
I hope you enjoyed learning about how to parse the RecurrenceRule in server side in ASP.NET MVC Scheduler.
You can refer to our ASP.NET MVC Scheduler feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our ASP.NET MVC Scheduler example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!