ics c#asp.net约会邀请
问题描述:
我想创建一个使用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;
}
答
主题是在摘要:参数。描述:用于“身体”。
与会者使用ATTENDEE加入:属性,即
ATTENDEE; CUTYPE =个人; ROLE = REQ-参与者; RSVP = TRUE; CN = “约翰·史密斯” ; X-NUM-客人= 0:的mailto :[email protected]
+0
谢谢彼得! – user3690095
是不是在您的代码中的变量中指出的“主题”字段“摘要”? –
使用可以为您创建必要信息的库,而不是自己重新创建它,您可能会好得多。看看[DDay.iCal](https://github.com/mdavid/DDay.iCal)。 – mason