Back to Devexpress

iCalendarImporter.CalendarStructureCreated Event

corelibraries-devexpress-dot-xtrascheduler-dot-icalendar-dot-icalendarimporter-8c911ec5.md

latest4.4 KB
Original Source

iCalendarImporter.CalendarStructureCreated Event

Fires when the calendar object conforming to the iCalendar specification is created.

Namespace : DevExpress.XtraScheduler.iCalendar

Assembly : DevExpress.XtraScheduler.v25.2.Core.Desktop.dll

NuGet Package : DevExpress.Scheduler.CoreDesktop

Declaration

csharp
public event iCalendarStructureCreatedEventHandler CalendarStructureCreated
vb
Public Event CalendarStructureCreated As iCalendarStructureCreatedEventHandler

Event Data

The CalendarStructureCreated event's data class is iCalendarStructureCreatedEventArgs. The following properties provide information specific to this event:

PropertyDescription
CalendarsProvides access to the calendar structures conforming to the iCalendar specification.

Remarks

Handle the CalendarStructureCreated event to obtain information on the iCalendar object, accessing its properties and attributes.

Example

The following example illustrates how the calendar structure constructed by the iCalendarImporter can be used to determine the time when the original appointment was created and the application used for .ics file generation.

The iCalendarImporter.CalendarStructureCreated event is handled and DevExpress.XtraScheduler.iCalendar.Components.iCalendarComponent object properties are inspected. The ProductIdentifier property specifies the identifier for the product that created the iCalendar object, the DevExpress.XtraScheduler.iCalendar.Components.VEvent.Created property specifies the date and time that the calendar information was created by the calendar user agent in the calendar store.

The information message is appended to the appointment’s subject, as illustrated in the following picture:

csharp
using DevExpress.XtraScheduler;
using DevExpress.XtraScheduler.iCalendar;
using DevExpress.XtraScheduler.iCalendar.Components;
// ...
void importer_CalendarStructureCreated(object sender, iCalendarStructureCreatedEventArgs e) {
    iCalendarComponent cal = e.Calendars[0];
    string productId = cal.ProductIdentifier.Value;
    for (int i = 0; i < cal.Events.Count; i++)
    {
        VEvent ev = cal.Events[i];
        DateTime created = ev.Created.Value;
        ev.Description.Value += string.Format("[COMMENT: The event was originally created on" + 
        "{0} at {1} by an application with productId {2}]",
        created.ToShortDateString(), created.ToShortTimeString(), productId);
    }
}
vb
Imports DevExpress.XtraScheduler
Imports DevExpress.XtraScheduler.iCalendar
Imports DevExpress.XtraScheduler.iCalendar.Components
' ...
Private Sub importer_CalendarStructureCreated(ByVal sender As Object, _
    ByVal e As iCalendarStructureCreatedEventArgs)

    Dim cal As iCalendarComponent = e.Calendars(0)
    Dim productId As String = cal.ProductIdentifier.Value
    Dim i As Integer = 0
    Do While i < cal.Events.Count
        Dim ev As VEvent = cal.Events(i)
        Dim created As DateTime = ev.Created.Value
        ev.Description.Value += String.Format("[COMMENT: The event was originally created on"
        & "{0} at {1} by an application with productId {2}]",
        created.ToShortDateString(), created.ToShortTimeString(), productId)
        i += 1
    Loop
End Sub

See Also

CalendarStructureCreated

iCalendarImporter Class

iCalendarImporter Members

DevExpress.XtraScheduler.iCalendar Namespace