I am using your code - except that I'm getting the appointment data from the database and populating a new Appointment object, then using ExportToICalendar to generate the ics file. It was working before.
I am trying to determine which of the two events broke it.
1) Enterprise update to Exchange/Outlook 2013
2) Updating the project to Q2 2014
I will continue to research the Exchange/Outlook side.
Here's my code in case you can spot an obvious problem:
protected void btnAddTimeslotToOutlook_Click(object sender, CommandEventArgs e)
{
int attendeeid;
if (Int32.TryParse(e.CommandArgument.ToString(), out attendeeid))
{
using (DataSet ds = Attendees.AttendeeDetails(attendeeid))
{
if (ds.Tables.Count > 0)
{
if (ds.Tables[0].Rows.Count > 0)
{
object id = ds.Tables[0].Rows[0]["EventID"].ToString();
string subject = ds.Tables[0].Rows[0]["EventName"].ToString();
string description = DataCleanup.StripHtml(ds.Tables[0].Rows[0]["Description"].ToString());
string location = ds.Tables[0].Rows[0]["Location"].ToString();
DateTime startdatetime = DateTime.Parse(ds.Tables[0].Rows[0]["TimeSlotStartTime"].ToString());
DateTime enddatetime = DateTime.Parse(ds.Tables[0].Rows[0]["TimeSlotEndTime"].ToString());
string timeslotinfo = string.Empty;
string apptdescription = string.Empty;
Appointment appointment = new Appointment();
appointment.ID = id;
appointment.Subject = subject;
appointment.Description = "Where: " + location + Environment.NewLine + Environment.NewLine + "What: " + description;
appointment.Start = startdatetime;
appointment.End = enddatetime;
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=\"RadSchedulerExport.ics\"");
response.Write(ParseForExport(appointment, location));
response.End();
}
}
}
}
}
protected static string ParseForExport(Appointment appt, string eventLocation)
{
string _apptdata = RadScheduler.ExportToICalendar(appt);
string _extraData = string.Empty;
if (!string.IsNullOrEmpty(eventLocation))
{
_extraData += "LOCATION:" + eventLocation + "\r\n";
}
if (_extraData.Length > 0)
{
_apptdata = _apptdata.Replace("BEGIN:VEVENT\r\n", "BEGIN:VEVENT\r\n" + _extraData);
}
return _apptdata;
}