.net Outlook的日历问题

sf6xfgos  于 2023-03-09  发布在  .NET
关注(0)|答案(1)|浏览(154)

我已经从C#生成日历邀请(.ics文件)。我也验证了使用icalendar验证器
但是,当我发送该文件从outlook到另一个outlook邮件它不显示为邀请。也与gmail到outlookoutlook到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:sender@example.com\r\n" +
                "ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Recipient Name:MAILTO:recipient@example.com\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到outlookoutlook到gmail工作正常

hc8w905p

hc8w905p1#

new ContentType("text/calendar; method=REQUEST")添加到日历项目

相关问题