TextProperty Class
Enables you to add a new property to the iCalendar component.
Namespace: DevExpress.XtraScheduler.iCalendar.Components
Assembly: DevExpress.XtraScheduler.v18.1.Core.dll
Declaration
Remarks
By default, the iCalendarExporter class implements only basic properties of the iCalendar component. To include other properties, such as ‘ATTENDEE’, ‘CONTACT’ or properties with arbitrary names, create an instance of the TextProperty class, corresponding to that property and add it to the collection accessible via the iCalendarComponentBase.CustomProperties.
The following code handles the AppointmentExporter.AppointmentExporting event of the iCalendarExporter. It uses the iCalendarComponentBase.CustomProperties property of the current VEvent object, accessible via the iCalendarAppointmentExportingEventArgs.VEvent property of the event arguments, to add addresses of the attendees to the exported object. So, the exported object is no longer an appointment, but a meeting request with attendees.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-extend-text-properties-of-appointments-exported-to-icalendar-format-e2437
using DevExpress.XtraScheduler.iCalendar;
using DevExpress.XtraScheduler;
using DevExpress.XtraScheduler.iCalendar.Components;
void ExportAppointments(Stream stream) {
if (stream == null)
return;
iCalendarExporter exporter = new iCalendarExporter(schedulerStorage1);
exporter.AppointmentExporting +=
new AppointmentExportingEventHandler(exporter_AppointmentExporting);
exporter.Export(stream);
}
void exporter_AppointmentExporting(object sender, AppointmentExportingEventArgs e) {
string s = Convert.ToString(e.Appointment.CustomFields[RecipientsDataColumn]);
string[] attendees = s.Split(';');
iCalendarAppointmentExportingEventArgs args = e as iCalendarAppointmentExportingEventArgs;
AddEventAttendees(args.VEvent, attendees);
}
private void AddEventAttendees(VEvent ev, string[] addresses) {
int count = addresses.Length;
for (int i = 0; i < count; i++)
AddEventAttendee(ev, addresses[i]);
}
private void AddEventAttendee(VEvent ev, string address) {
TextProperty p = new TextProperty("ATTENDEE",
String.Format("mailto:{0}", address));
p.AddParameter("CN", address);
p.AddParameter("RSVP", "TRUE");
ev.CustomProperties.Add(p);
}
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the TextProperty class.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.