2
votes

I'm developping a ics sender functionnality. But i have some trouble with office 365 and outlook. When i sent the ics file to google mail, i don't have any problem. My event appear in the gmail. But when i send to outlook or office 365, my appointment didn't appear but it was in the email attachment ( ATT00001.ics). This is the code send the mail

private void generateIcal(MimeMessage message) throws MessagingException, IOException {
        message.addHeaderLine("method=REQUEST");
        message.addHeaderLine("charset=UTF-8");
        message.addHeaderLine("component=VEVENT");
        message.setFrom(new InternetAddress(from));
        message.setSubject(subj,"UTF-8");
        StringBuffer sb = new StringBuffer();
// Create the message part
        BodyPart messageBodyPart = new MimeBodyPart();
// Fill the message
        messageBodyPart.setHeader("Content-Class", "urn:content-classes:calendarmessage");
        messageBodyPart.setHeader("Content-ID", "calendar_message");
        messageBodyPart.setDataHandler(new DataHandler(
                new ByteArrayDataSource(txt, "text/calendar;charset=utf-8")));//very important

// Create a Multipart
        Multipart multipart = new MimeMultipart();
// Add part one
        multipart.addBodyPart(messageBodyPart);

// Put parts in message
        message.setContent(multipart);
    }

And this generate the ics file

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//TELELANGUE//NONSGML v1.0//EN
BEGIN:VEVENT
DTSTART:20180714T170000Z
DTEND:20180715T035900Z
SUMMARY:Fête à la Bastille
END:VEVENT
END:VCALENDAR
2
erm, just my opinion... if there is a log that is allow to be shared would help those who experience to spot/ troubleshoot what would be the blockage...薛源少
Unfortunately, I don’t have any log because outlook don’t have any errorYellowStar22

2 Answers

3
votes

Thanks for your reply

Finally, I found the solution. Looks like, we need to set "method" and "name" parameters into the BodyPart.

MessageBodyPart.setDataHandler(new DataHandler(
                    new ByteArrayDataSource(buffer.toString(), "text/calendar;method=REQUEST;name=\"meeting.ics\"")));
0
votes

1) Parse the ics. file and make it an event in Inbox so that you can read the event information without opening the attachment.

2) Add interactivity so that you can accept/decline the invite directly from Inbox without even opening the ics file. (This is what Gmail has now).

For more information, please see the link below:

incoming calendar invites from outlook are blank

.ics files not showing up in the Outlook.com Inbox?