我正在尝试使用C#Asp.net创建Outlook约会ICS文件。下面是我从互联网上获得的示例代码,但它缺少主题,也缺少与会者。我如何在代码中包含它?例如,会议主题是:“财务会议”与会者是:Sam @ mycompany.com,Andy @ mycompany.com,Lisa @ mycompany.com
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;
}
答案 0 :(得分:2)
主题位于SUMMARY:参数中。描述:用于“身体”。
使用ATTENDEE:属性,即
添加参加者ATTENDEE; CUTYPE = INDIVIDUAL; ROLE = REQ-PARTICIPANT; RSVP = TRUE; CN =“John Smith” X-NUM-客人= 0:的mailto:john.smith@domain.com