Add a event to Outlook calendar dymatically
protected void btnAddEventToOutlook_Click(object sender, EventArgs e)
{
Response.Clear();
Response.AddHeader("content-disposition", string.Format("attachment;filename={0}.ics", HttpUtility.UrlEncode(EventName, Response.HeaderEncoding)));
Response.Write(string.Format(@"BEGIN:VCALENDAR
METHOD:PUBLISH
PRODID:-//{0}//NONSGML iCalcreator 2.6//ZH_TW
VERSION:2.0
X-WR-CALNAME;LANGUAGE=zh_tw:有 {1} 筆相關活動
BEGIN:VEVENT
UID:{2}
DTSTAMP:{3:yyyyMMddTHHmmss}Z
DESCRIPTION;LANGUAGE=zh_tw:{4}
DTSTART;TZID=TAIWAN:{5:yyyyMMddTHHmmss}
DTEND;TZID=TAIWAN:{6:yyyyMMddTHHmmss}
LOCATION;LANGUAGE=zh_tw:{7}
SUMMARY;LANGUAGE=zh_tw:{8}
URL;VALUE=URI:{9}
END:VEVENT
END:VCALENDAR",
Request.Url.Host,
PlaceCount,
Request.QueryString["oid"],
DateTime.Now,
Description,
Convert.ToDateTime(FromDate),
Convert.ToDateTime(ToDate),
Location,
EventName,
Request.Url));
Response.End();
}
about
ics file