有没有更好的方法来处理Microsoft Outlook中的日历事件文件(.ics)?

时间:2018-05-16 07:01:27

标签: java outlook calendar javamail

DateFormat iCalendarDateFormat = new SimpleDateFormat("yyyyMMdd'T'HHmmss'Z'");
        Date dTstamp = new Date();
        String start=iCalendarDateFormat.format(startDate);
        String end=iCalendarDateFormat.format(endDate);
        StringBuffer buffer = sb.append(
                                          "BEGIN:VCALENDAR\n" +
                                          "PRODID:-//Microsoft Corporation//Outlook 11.0 MIMEDIR//EN\n"
                                          + "VERSION:2.0\n" 

                /*"BEGIN:VCALENDAR\n" + "X-LOTUS-CHARSET:UTF-8\n"
                        + "PRODID:-//Lotus Development Corporation//NONSGML Notes 8.5//EN_C\n" + "VERSION:2.0\n"*/
                        + "METHOD:REQUEST\n" + "BEGIN:VEVENT\n" + "DTSTAMP:"+dTstamp+"\n"
                        +"DTSTART:"+start+"\n" + "DTEND:"+end+"\n" + "SUMMARY:"+msg+"\n"
                        + "UID:324\n"
                        + "ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE:MAILTO:"+emailAddress+"\n"
                        + "ORGANIZER:MAILTO:"+"abc@xyz.com"+"\n" +
                        /*
                         * "DTSTART:20051208T053000Z\n" +
                         * "DTEND:20051208T060000Z\n" +
                         */
                        "LOCATION:"+location+"\n" + "TRANSP:OPAQUE\n" + "SEQUENCE:0\n"
                        + "UID:040000008200E00074C5B7101A82E00800000000002FF466CE3AC5010000000000000000100\n"
                        + " 000004377FE5C37984842BF9440448399EB02\n" +
                        /* "DTSTAMP:20051206T120102Z\n" + */
                        "CATEGORIES:Meeting\n" + "DESCRIPTION:"+msg+".\n\n"
                        + "SUMMARY:"+subject+"\n" + "PRIORITY:5\n" + "CLASS:PUBLIC\n" + "BEGIN:VALARM\n"
                        + "TRIGGER:PT1440M\n" + "ACTION:DISPLAY\n" + "DESCRIPTION:Reminder\n" + "END:VALARM\n"
                        + "END:VEVENT\n" + "END:VCALENDAR");

        Multipart mp = new MimeMultipart();
        // create and fill the body of the message
        MimeBodyPart body = new MimeBodyPart();
        // Fill the message
        body.setHeader("Content-Class", "urn:content-  classes:calendarmessage");
        body.setHeader("Content-ID", "calendar_message");

我使用java Mail API创建了日历服务。如果没有将文件作为附件发送,用户可以直接查看日历事件,就像有人创建事件并且用户接受/拒绝它一样?

0 个答案:

没有答案