Class CalendarReader
Contents
[
Hide
]CalendarReader class
Provides functionality to read and extract events from an ICS (iCalendar) file.
public class CalendarReader
Constructors
| Name | Description |
|---|---|
| CalendarReader(Stream) | Initializes a new instance of CalendarReader with source stream and default Appointment LoadOptions. |
| CalendarReader(string) | Initializes a new instance of CalendarReader with source file and default Appointment LoadOptions. |
| CalendarReader(Stream, AppointmentLoadOptions) | Initializes a new instance of CalendarReader with source stream and Appointment LoadOptions. |
| CalendarReader(string, AppointmentLoadOptions) | Initializes a new instance of CalendarReader with source file and Appointment LoadOptions. |
Properties
| Name | Description |
|---|---|
| Count { get; } | Gets the number of Vevent components. |
| Current { get; } | Current read event. |
| IsMultiEvents { get; } | Gets whether calendar contains multi events. |
| Method { get; } | Gets the iCalendar object method type associated with the calendar object. |
| Version { get; } | Gets the Version of calendar. |
Methods
| Name | Description |
|---|---|
| LoadAsMultiple() | Loads a list of events from a calendar with multiple events. |
| NextEvent() | Reads next Event from source and save it to the Current. |
Remarks
The CalendarReader class allows sequential reading of events from an iCalendar (.ics) file. It is designed to parse and access event details such as appointments, meetings, and other calendar items.
Examples
This example demonstrates how to read multiple events from an ICS file and store them in a list of Appointment objects.
[C#]
// Create a list to hold the appointments
var appointments = new List<Appointment>();
// Initialize CalendarReader with the ICS file path
var reader = new CalendarReader("US-Holidays.ics");
// Iterate through the events in the ICS file
while (reader.NextEvent())
{
// Add the current event to the appointments list
appointments.Add(reader.Current);
}
// Working with the appointments...
[Visual Basic]
' Create a list to hold the appointments
Dim appointments As New List(Of Appointment)
' Initialize CalendarReader with the ICS file path
Dim reader As New CalendarReader("US-Holidays.ics")
' Iterate through the events in the ICS file
While reader.NextEvent()
' Add the current event to the appointments list
appointments.Add(reader.Current)
End While
' Working with the appointments...
See Also
- namespace Aspose.Email.Calendar
- assembly Aspose.Email