简体   繁体   English

使用Java API在Lotus Notes上会议邀请

[英]Meeting Invite on Lotus notes using Java API

I am getting some problem while sending meeting invite in lotus notes.i am trying to see in the accept/decline feature format but instead it is just coming up as add to Calendar Feature only.So if anyone can help me with this would be great.here is my code 我在莲花笔记中发送会议邀请时遇到了一些问题。我正在试图看到接受/拒绝功能格式,但它只是作为添加到日历功能而出现。所以,如果有人可以帮助我,这将是伟大的我的代码

        Properties props = new Properties();
        props.put("mail.smtp.host", SMTP_HOST_NAME);

        props.put("mail.smtp.auth", "false");

        Authenticator auth = new SMTPAuthenticator();
        Session session = Session.getInstance(props, auth);

        session.setDebug(debug);

        MimeMessage msg = new MimeMessage(session);
        msg.addHeaderLine("method=REQUEST");
        msg.addHeaderLine("charset=UTF-8");
        msg.addHeaderLine("component=VEVENT");

        InternetAddress addressFrom = new InternetAddress(from);
        msg.setFrom(addressFrom);

        if (!(recipients == null)) {

            InternetAddress[] addressTo = new InternetAddress[recipients.length];
            for (int i = 0; i < recipients.length; i++) {
                addressTo[i] = new InternetAddress(recipients[i]);

            }

            log.debug("setting to recipients");
            msg.setRecipients(Message.RecipientType.TO, addressTo);

        }
        if (!(recipientCC == null)) {

            InternetAddress[] addressCC = new InternetAddress[recipientCC.length];
            for (int j = 0; j < recipientCC.length; j++) {
                addressCC[j] = new InternetAddress(recipientCC[j]);

            }
            log.debug("setting cc recipients");
            msg.setRecipients(Message.RecipientType.CC, addressCC);

        }

        msg.setSubject(subject);

        StringBuffer sb = new StringBuffer();

        StringBuffer buffer = sb
                .append("BEGIN:VCALENDAR\n"
                        + "X-LOTUS-CHARSET:UTF-8\n"
                        + "PRODID:-//Lotus Development Corporation//NONSGML Notes 8.5//EN_C\n"
                        + "VERSION:2.0\n"
                        + "BEGIN:VEVENT\n"
                        + "CATEGORIES:Meeting\n"
                        + "STATUS:NEEDS ACTION\n"
                        + "DTSTART:20130727T184555\n"
                        + "DTEND:20130727T194555\n"
                        + "DTSTAMP:20130727T184555\n"
                        + "SEQUENCE:0\n"
                        + "EXPECT:IMMEDIATE\n"
                        + "DESCRIPTION:Steve and John to review newest proposal material\n"
                        + "SUMMARY:"
                        + subject
                        + "\n"
                        + "CLASS:PUBLIC\n"
                        + "UID:86DC83601F9625C465257BB40047FE17-Lotus_Notes_Generated\n"
                        + "X-LOTUS-UPDATE-SEQ:1\n"
                        + "X-LOTUS-UPDATE-WISL:$S:1;$L:1;$B:1;$R:1;$E:1;$W:1;$O:1;$M:1\n"
                        + "X-LOTUS-NOTESVERSION:2\n"
                        + "X-LOTUS-NOTICETYPE:I\n"
                        + "X-LOTUS-APPTTYPE:3\n"
                        + "X-LOTUS-CHILD-UID:86DC83601F9625C465257BB40047FE17\n"
                        + "END:VEVENT\n" + "END:VCALENDAR\n");

        // 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(
                        buffer.toString(), "text/calendar")));// very
                                                                // important
        // Create a Multipart
        Multipart multipart = new MimeMultipart();

        // Add part one
        multipart.addBodyPart(messageBodyPart);

        // Put parts in message

        msg.setContent(multipart);
        log.debug("Sending mail");
        Transport.send(msg);

You need to create a group event instead of a public event, if you want to be able to respond. 如果您希望能够响应,则需要创建组事件而不是公共事件。 You can read everything about this in the RFC 2446 . 您可以在RFC 2446中阅读有关此内容的所有内容。

It is mandatory to define attendees for a group event to work (see Chapter 4.2 in above documentation). 必须为组事件定义与会者才能工作(请参阅上述文档中的第4.2章)。 This might look like this: 这可能如下所示:

ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED;CN=BIG A:Mailto:A@example.com
ATTENDEE;RSVP=TRUE;TYPE=INDIVIDUAL;CN=B:Mailto:B@example.com

RSVP=TRUE lets B respond. RSVP = TRUE让B响应。

If you need to make sure, that appointments do not get mixed up, generate a unique uid for every event and reuse it if something changes. 如果您需要确保这些约会不会混淆,请为每个事件生成一个唯一的uid,并在发生变化时重复使用它。 Otherwise you will not be able to send updates. 否则您将无法发送更新。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM