tags:

views:

12

answers:

1

Hello experts, I have to send mutiple events with one .ics file using ASpnetMail Class in vb.net. and i went throgh the ASpnetMail documention but i didn't get any clue.. Please suggest me... Reagrds Pankaj Pareek.

A: 

Hi,

What you will want to do, is create a 2nd event, and add it to the ical.Events collection.

Here is a code example that a customer needed, for streaming the iCal to the browser. You could have just of easily of added it to an EmailMessage object, and sent it in an email.

iCalendar ical = new iCalendar(); ical.Method.Value = "Publish";

 //create the 1st event
 EventComponent e1 = new EventComponent();
 e1.Summary.Text = "Last Day for Dropping Winter Term Course with \"W\"";
 e1.Description.Text = "Last Day for Dropping Winter Term Course with \"W\"";
 DateTime startAt = new DateTime( 2009, 01, 12, 8, 0, 0 );
 e1.DateStart.Date = startAt;
 e1.DateEnd.Date = startAt.AddHours( 9 );
 ical.Event = e1;

 //create the 2nd event
 EventComponent e2 = new EventComponent();
 e2.Summary.Text = "Martin Luther King Jr. Holiday";
 e2.Description.Text = "Martin Luther King Jr. Holiday";
 DateTime startAt2 = new DateTime( 2009, 01, 16, 8, 0, 0 );
 e2.DateStart.Date = startAt2;
 e2.DateEnd.Date = startAt2.AddHours( 9 );
 //add it to the Events collection
 ical.Events.Add( e2 );

 //save to a file
 ical.WriteToFile( "c:\\temp\\somefile.ics");

 //stream the file to the browser
 Response.ClearHeaders();
 Response.ContentType = "text/calendar";
 Response.AppendHeader( "Filename", "events.ics");
 Response.AppendHeader("Content-Disposition", "attachment;filename=events.ics");

 ical.WriteToStream( Response.OutputStream );

 Response.Flush();
 Response.End();

Does that help?
--Dave

dave wanta