Hi
I'm working on "Add to Calendar" feature from my Sharepoint webpart (created using VS2010). If I want to include multiple breakdown appointments (For Ex, one for today between 9.00 a.m - 11 a.m & one for tomorrow between 3.00 p.m - 5.00 p.m), How do I do that?
The following code works for a single appointment. Its creating an additional calendar if I have more that one appointment.
Instead I should be able to update my existing calendar with the multiple appointments.
Could you please assist me how to do this?
Here is part of my code
I'm working on "Add to Calendar" feature from my Sharepoint webpart (created using VS2010). If I want to include multiple breakdown appointments (For Ex, one for today between 9.00 a.m - 11 a.m & one for tomorrow between 3.00 p.m - 5.00 p.m), How do I do that?
The following code works for a single appointment. Its creating an additional calendar if I have more that one appointment.
Instead I should be able to update my existing calendar with the multiple appointments.
Could you please assist me how to do this?
Here is part of my code
//........
EventSessions = from eventobj1
in
context.EventSessions
where eventobj1.Event.Id == eventid
select eventobj1;
foreach
(EventSessionsItem session
in
EventSessions)
{
Appointment _appointment =
new
Appointment();
editor.Content = session.Event.EventDetails;
_appointment.Subject = session.Title;
_appointment.Description = Server.HtmlDecode(editor.Text);
_appointment.Start = session.DateOfSession.Value;
_appointment.End = dtStart.AddHours(session.SessionDuration.Value);
sbICSFile.Append(RadScheduler.ExportToICalendar(_appointment));
}
WriteCalendar(sbICSFile.ToString());
private
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=\"Calendar.ics\""
);
response.Write(data);
response.End();
}