我想創建一個使用C#Asp.net的Outlook預約ICS文件。以下是我從互聯網上獲得的示例代碼,但它缺少Subject和參與者。我怎樣才能在代碼中包含它?例如會議主題是:「財經會議」與會者是:[email protected],[email protected],[email protected]ics c#asp.net約會邀請
public string MakeHourEvent(string subject, string location, DateTime date, string startTime, string endTime)
{
string filePath = string.Empty;
string path = HttpContext.Current.Server.MapPath(@"\iCal\");
filePath = path + subject + ".ics";
writer = new StreamWriter(filePath);
writer.WriteLine("BEGIN:VCALENDAR");
writer.WriteLine("VERSION:2.0");
writer.WriteLine("PRODID:-//hacksw/handcal//NONSGML v1.0//EN");
writer.WriteLine("BEGIN:VEVENT");
string startDateTime = GetFormatedDate(date)+"T"+GetFormattedTime(startTime);
string endDateTime = GetFormatedDate(date) + "T" + GetFormattedTime(endTime);
writer.WriteLine("DTSTART:" + startDateTime);
writer.WriteLine("DTEND:" + endDateTime);
writer.WriteLine("SUMMARY:" + subject);
writer.WriteLine("LOCATION:" + location);
writer.WriteLine("END:VEVENT");
writer.WriteLine("END:VCALENDAR");
writer.Close();
return filePath;
}
是不是在您的代碼中的變量中指出的「主題」字段「摘要」? –
使用可以爲您創建必要信息的庫,而不是自己重新創建它,您可能會好得多。看看[DDay.iCal](https://github.com/mdavid/DDay.iCal)。 – mason