Multiple appointments through RadScheduler control - Exporting ICS File

2 posts, 0 answers
  1. John
    John avatar
    9 posts
    Member since:
    Nov 2010

    Posted 07 Feb 2012 Link to this post

    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 

                    //........
                    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();
    }

  2. Cat Cheshire
    Cat Cheshire avatar
    128 posts
    Member since:
    Jun 2010

    Posted 12 Feb 2012 Link to this post

    How exactly you populate the scheduler with data?
    Why are you overriding the response?
Back to Top