我想知道是否可以创建一个文件。新会议的 Ics 已经预先填写了收件人的电子邮件地址?是否可以将这些电子邮件地址作为参数发送?或者,这根本不可能?
像这样 :
这是我以前运行良好的代码:
public string subject = string.Empty;
public string body = string.Empty;
public string uid = string.Empty;
public DateTime date ;
public Random rand;
protected void Page_Load(object sender, EventArgs e)
{
rand = new Random();
subject = "meeting event";
body = "invitation meeting test";
date = new DateTime(2014,1,1);
uid = "CHE-106.802.033";
openEventCalendar();
}
public void openEventCalendar()
{
Response.ContentType = "text/v-calendar";
Response.AddHeader(
"content-disposition", "attachment; filename=" + subject + ".ics");
Response.Write("BEGIN:VCALENDAR" + Environment.NewLine);
Response.Write(
"PRODID: -//Microsoft Corporation//Outlook 12.0 MIMEDIR//EN" + Environment.NewLine);
Response.Write("VERSION:2.0" + Environment.NewLine);
Response.Write(
"METHOD:PUBLISH" + Environment.NewLine);
Response.Write("X-MS-OLK-FORCEINSPECTOROPEN:TRUE" + Environment.NewLine);
Response.Write(
"BEGIN:VEVENT" + Environment.NewLine);
Response.Write("CLASS:PUBLIC" + Environment.NewLine);
Response.Write(
"CREATED:" + date.ToString("s") + Environment.NewLine);
Response.Write("DESCRIPTION:" + body + Environment.NewLine);
Response.Write(
"DTEND:" + date.AddMinutes(30).ToString("s") + Environment.NewLine);
Response.Write("DTSTAMP:" + date.ToString("s") + Environment.NewLine);
Response.Write(
"DTSTART:" + date.ToString("s") + Environment.NewLine);
Response.Write("LAST-MODIFIED:" + date.ToString("s") + Environment.NewLine);
Response.Write(
"LOCATION:LM Reminder" + Environment.NewLine);
Response.Write("PRIORITY:5" + Environment.NewLine);
Response.Write(
"SEQUENCE:0" + Environment.NewLine);
Response.Write("SUMMARY;LANGUAGE=en-us:" + subject + Environment.NewLine);
Response.Write(
"TRANSP:OPAQUE" + Environment.NewLine);
Response.Write(string.Format("UID:{0}-{1}", uid, rand.Next(1000)) + Environment.NewLine);
//Response.Write(@"X-ALT-DESC;FMTTYPE=text/html:<!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 3.2//EN>\n<HTML>\n<HEAD>\n<META NAME='Generator' CONTENT='MS Exchange Server version 08.00.0681.000'>\n<TITLE></TITLE>\n</HEAD>\n<BODY>\n\n\n<P DIR=LTR><SPAN LANG='en-us'></SPAN><SPAN LANG='en-us'></SPAN><SPAN LANG='en-us'><FONT SIZE=2 FACE='Arial'>" + Body + "</FONT></SPAN><SPAN LANG='en-us'></SPAN><SPAN LANG='en-us'></SPAN><SPAN LANG='en-us'></SPAN></P>\n\n</BODY>\n</HTML>" + Environment.NewLine);
Response.Write("SUMMARY:" + subject + Environment.NewLine);
Response.Write(
"X-MICROSOFT-CDO-BUSYSTATUS:BUSY" + Environment.NewLine);
Response.Write("X-MICROSOFT-CDO-IMPORTANCE:1" + Environment.NewLine);
Response.Write(
"BEGIN:VALARM" + Environment.NewLine);
Response.Write("TRIGGER:-PT15M" + Environment.NewLine);
Response.Write(
"ACTION:DISPLAY" + Environment.NewLine);
Response.Write("DESCRIPTION:Reminder" + Environment.NewLine);
Response.Write(
"END:VALARM" + Environment.NewLine);
Response.Write("END:VEVENT" + Environment.NewLine);
Response.Write(
"END:VCALENDAR" + Environment.NewLine);
}