TextProperty Class
Enables you to add a new property to the iCalendar component.
Namespace: DevExpress.XtraScheduler.iCalendar.Components
Assembly: DevExpress.XtraScheduler.v24.1.Core.Desktop.dll
NuGet Package: DevExpress.Scheduler.CoreDesktop
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.
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);
}