我已从 C#(.ics 文件)生成日历邀请。我还使用 icalendar 验证器进行了验证。
但是当我将该文件从 outlook 发送到另一个 Outlook 邮件时,它不会显示为邀请。 它也可以与 gmail 到 Outlook 和 outlook 到 gmail
配合使用。/ Create a calendar invitation
string icsContent =
"BEGIN:VCALENDAR\r\n" +
"PRODID:-//Microsoft Corporation//Outlook 16.0 MIMEDIR//EN\r\n" +
"VERSION:2.0\r\n" +
"METHOD:REQUEST\r\n" +
"BEGIN:VEVENT\r\n" +
"DTSTART:20230302T160000Z\r\n" +
"DTEND:20230302T170000Z\r\n" +
"LOCATION:Conference Room\r\n" +
"UID:" + Guid.NewGuid().ToString() + "\r\n" +
"DESCRIPTION:Please join us for a meeting.\r\n" +
"SUMMARY:Meeting Invitation\r\n" +
"ORGANIZER;CN=Sender Name:MAILTO:[email protected]\r\n" +
"ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Recipient Name:MAILTO:[email protected]\r\n" +
"END:VEVENT\r\n" +
"END:VCALENDAR\r\n";
// Add the calendar invitation as an attachment
Attachment icsAttachment = new Attachment(new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(icsContent)), "invitation.ics", "text/calendar");
message.Attachments.Add(icsAttachment);
但是当我将该文件从 outlook 发送到另一个 Outlook 邮件时,它不会显示为邀请。 它也可以与 gmail 到 Outlook 和 outlook 到 gmail
配合使用。将
new ContentType("text/calendar; method=REQUEST")
添加到日历项目