VCal Event not showing in Outlook

290 views Asked by At

I'm trying to send an iCal invitation but I can't make it show as an event in outlook when I send it through the Exchange server. If I use an external IMAP server everything is working fine, it seems like a problem with Exchange (maybe some configuration)

This is the event, nothing special (I've omitted the information)

BEGIN:VCALENDAR
VERSION:2.0
METHOD:PUBLISH
BEGIN:VEVENT
DTSTAMP:20131205T154852Z
UID:20131205T154852Z-1
SUMMARY:I
X-ALT-DESC;FMTTYPE=text/html:
DTSTART:20131206T090000
DTEND:20131206T180000
ORGANIZER:mailto:
ATTENDEE;ROLE=REQ-PARTICIPANT;
END:VEVENT
END:VCALENDAR

Maybe is there some additional header I should put to force Outlook to see it as an event.

I'm sending it using this Java code through an SMTP internal server.

    final MimeMessage message = getMimeMessage(mailSession, template);
    Multipart multipart = new MimeMultipart();
    message.setContent(multipart);
    Transport.send(message);

and this library (ical4j)

    MimeBodyPart iCalEvent = new MimeBodyPart();
    iCalEvent.addHeader("Content-Class", "urn:content-classes:calendarmessage");
    net.fortuna.ical4j.model.Calendar calendar = createICalInvitation("1", subject, description, start, end, timeZone, recipients, location);
    iCalEvent.setContent(calendar.toString(),"text/calendar;method=PUBLISH;charset=\"UTF-8\"");
    multipart.addBodyPart(iCalEvent);

According to this bug, outlook should have method=PUBLISH to correctly render the event

1

There are 1 answers

0
Luca Molteni On BEST ANSWER

It seems like it was because I used a multipart message.

When I switched to a simple MimeMessage everything worked fine.