I have faced a problem when I click on "Export to Outlook" button for a recurring appointment, which is set to recurr yearly on a specific date.
It says "Appointment.ics is not a valid Internet Calendar file".
I tried creating a yearly recurring appointment at
http://demos.telerik.com/aspnet-ajax/scheduler/examples/export/defaultcs.aspx
and received the same above mentioned error.
I use Outlook 2007 as the mail client.
The code used is:
#region
RadScheduler AppointmentCommand Event
protected void RadScheduler1_AppointmentCommand(object sender, AppointmentCommandEventArgs e)
{
if (e.CommandName == "Export")
{
//RadAjaxManager1.RaisePostBackEvent(e.ToString());
TimeSpan currentOffset = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now);
//string iCal = RadScheduler.Export(apt, currentOffset);
WriteCalendar(
RadScheduler.ExportToICalendar(e.Container.Appointment, currentOffset));
}
}
#endregion
#region
WriteCalendar (for export to outlook)
public void WriteCalendar(string data)
{
HttpResponse response = Page.Response;
response.Clear();
response.Buffer =
true;
response.ContentType =
"text/calendar";
response.ContentEncoding =
Encoding.UTF8;
response.Charset =
"utf-8";
response.AddHeader(
"Content-Disposition", "attachment;filename=\"Appointment.ics\"");
response.Write(data);
response.End();
}
#endregion
Please let us know if we are missing anything.
Any help urgently will be highly appreciated.