Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Invitations generated by my ASP.net application, sent as email with .ics attachment to Outlook 2010, are not being processed by the sniffer. As such, they are not appearing as tentative in the calendar, and are not available in the preview pane. The .ics attachment appears to be valid and can be opened in outlook by double clicking. The same invitations sent to Gmail are processed no worries. I have ruled out a number of accepted solutions to the same problem...

  • Outlook is correctly configured, and processes Gmail invitations no problem
  • The message is sent as Content-Type: multipart/mixed, with the attachment as text/calendar.
  • DTEND follows DTSTART !
  • The invitation includes an organizer and an attendee.

The most obvious difference between my invitations and Gmails' is the absence of a DKIM signature, but others have succeeded without this. More generally, has anyone found any microsoft documentation about the operation, logging or troubleshooting of the sniffer?

This is my .ics attachment.

BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:REQUEST
BEGIN:VEVENT
DTSTART:20140617T083644Z
DTEND:20140617T093644Z
DTSTAMP:20140617T083647Z
ORGANIZER;CN=sby@dimo-gestion.fr:mailto:sby@dimo-gestion.fr
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=
 FALSE;CN=bbsimonbb@gmail.com;X-NUM-GUESTS=0:mailto:bbsimonbb@gmail.com
CREATED:20140617T083647Z
DESCRIPTION:Description of flying to Sligo
LAST-MODIFIED:20140617T083647Z
LOCATION:
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:Fly to Sligo
TRANSP:OPAQUE
UID:20140617T083647Z
END:VEVENT
END:VCALENDAR

The property X-MS-OLK-FORCEINSPECTOROPEN, specified here, hasn't helped.

My file passes the three iCalendar validators mentionned in this question

My god the internet is clogging up with folk who can't get their invitations into Outlook. Here, here, and here.

The consensus seems to be that you need to add "; method=REQUEST" after the content type in the header of the calendar MIME part. Trouble is, the .net System.Net.Mail library doesn't seem to offer low level access to set this line. The hunt continues.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
197 views
Welcome To Ask or Share your Answers For Others

1 Answer

Ok I've cracked it. The solution that's worked for me is the combination of the two suggestions here. The text/calendar part must be the only part of the message, and method=REQUEST must be present in the Content-Type header.

To achieve this in .net, you can use AlternateViews as follows...

MailMessage msg = new MailMessage();
msg.From = new MailAddress("gonzo@work");
msg.To.Add("gonzo@home");

System.Net.Mime.ContentType mimeType = new System.Net.Mime.ContentType("text/calendar; method=REQUEST");
AlternateView icalView = AlternateView.CreateAlternateViewFromString(icalendarString, mimeType);
icalView.TransferEncoding = TransferEncoding.SevenBit;
msg.AlternateViews.Add(icalView);
client.Send(msg);

The nice bit is that, in the absence of a body, attachments or other alternate views, .net is clever enough to construct a mail with just one part. Using an alternateView remains necessary, because it's the only way to control the Content-type header. This trick could be useful for anyone else who wants to set the Content-Type of a simple single-part mail in .net. The resulting mail, then, looks like this...

MIME-Version: 1.0
From: gonzo@work
To: gonzo@home
Subject: Fly to Sligo
Content-Type: text/calendar; method=REQUEST
Content-Transfer-Encoding: 7bit

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//www.notilus.com//Dimo Gestion Notilus//FR
CALSCALE:GREGORIAN
METHOD:REQUEST
X-MS-OLK-FORCEINSPECTOROPEN:TRUE
BEGIN:VEVENT
DTSTART:20140619T080132Z
DTEND:20140619T090132Z
DTSTAMP:20140619T080132Z
ORGANIZER;CN=gonzo@work:mailto:gonzo@work
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=
 FALSE;CN=gonzo@home;X-NUM-GUESTS=0:mailto:gonzo@home
CREATED:20140619T080132Z
DESCRIPTION:Description of flying to Sligo
X-ALT-DESC;FMTTYPE=text/html:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//E
 N">
<html>
<body>
<table border="1"><tr><td>
<b>HTML</b> Description o
 f flying to Sligo
</td></tr><tr><td>
<ul><li>HTML has certain advantages
 </li></ul>
</td></tr></table>
</body>
</html>
LAST-MODIFIED:20140619T080132Z
LOCATION:
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:Fly to Sligo
TRANSP:OPAQUE
UID:20140619T080132Z
END:VEVENT
END:VCALENDAR

A big thank you to gmail, for effortlessly constructing a working example, and for the marvelous "show original" option. As discussed above, google somehow manages to have a much more complicated message processed correctly, but you need to be a google programmer to figure that out.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...