从Lotus发送日历邀请以通过java domino api进行交换

问题描述 投票:2回答:2

[我正在尝试通过JAVA Domino API将日历邀请从Lotus发送到Exchange。当我从一个莲花帐户向另一个莲花帐户发送邀请时,邀请成功。但是,当我将其发送到某个Exchange邮件帐户时,Exchange不会将其显示为邀请。

我正在使用的代码如下:

package com.test;

import java.util.Date;
import java.util.Vector;

import lotus.domino.Database;
import lotus.domino.DateTime;
import lotus.domino.Document;
import lotus.domino.NotesFactory;
import lotus.domino.Session;
import lotus.entity.Meeting;

import com.data.Strings;

public class CalenderTest {

    public static void main(String[] args){

        Vector<String> sendTo = new Vector<String>();
        sendTo.add("xxxx.xx.com");

        Meeting m =  new Meeting();
        m.setDate("04-04-2013");
        m.setTime("06:06:06");
        m.setHours("4");
        m.setChair("xxxx.xx.com");
        m.setSubject("Testing Calendar");
        m.setLocation("TestLocation");
        m.setBody("TestBody");
        m.setSendTo(sendTo);

        try
        {
            Session s = NotesFactory.createSessionWithIOR(Strings.IOR, "xxxxxxx", "xxxxx");
            Database db = s.getDatabase(s.getServerName(), "xxxx");

            Document doc1 = db.createDocument(); 
            doc1.appendItemValue("Form","Notice"); 
            doc1.appendItemValue("NoticeType","I");
            doc1.appendItemValue("_ViewIcon","133.0"); 
            doc1.appendItemValue("AppointmentType","3"); 
            Session stmp = db.getParent(); 
            String[] date = m.getDate().split("-");
            String[] time = m.getTime().split(":");
            Date exdate = new Date();
            exdate.setDate(Integer.parseInt(date[0]));
            exdate.setHours(Integer.parseInt(time[0]));
            exdate.setMinutes(Integer.parseInt(time[1]));
            exdate.setMonth(Integer.parseInt(date[1])-1);
            exdate.setSeconds(Integer.parseInt(time[2]));
            exdate.setYear(Integer.parseInt(date[2])-1900);
            System.out.println(exdate.toString());
            DateTime currTime =  stmp.createDateTime(exdate); 
            doc1.appendItemValue("StartDateTime",currTime) ; 
            doc1.appendItemValue("CalendarDateTime",currTime); 
            doc1.appendItemValue("StartDate",currTime) ; 
            doc1.appendItemValue("StartTime",currTime) ; 
            currTime.adjustHour(Integer.parseInt(m.getHours()), true); 
            doc1.appendItemValue("EndDateTime",currTime) ; 
            doc1.appendItemValue("EndDate",currTime) ; 
            doc1.appendItemValue("EndTime",currTime) ; 
            doc1.appendItemValue("$NoPurge",currTime) ; 
            doc1.appendItemValue("Subject",m.getSubject());  
            doc1.appendItemValue("Location",m.getLocation()); 
            doc1.appendItemValue("Body",m.getBody()); 
            doc1.appendItemValue("From",s.getUserName());
            doc1.appendItemValue("Chair",m.getChair());
            doc1.appendItemValue("RequiredAttendees",m.getSendTo());
            doc1.appendItemValue("OPTIONALATTENDEES",m.getCopyTo());
            doc1.computeWithForm(true, false);
            doc1.save(true, false, false);
            doc1.send(m.getSendTo());
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }
}

任何人都可以提出建议吗?

java lotus-notes lotus-domino lotus
2个回答
3
投票

一种可能是发送。ics文件:

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
BEGIN:VEVENT
UID:[email protected]
DTSTAMP:19970714T170000Z
ORGANIZER;CN=John Doe:MAILTO:[email protected]
DTSTART:19970714T170000Z
DTEND:19970715T035959Z
SUMMARY:Bastille Day Party
END:VEVENT
END:VCALENDAR

http://en.wikipedia.org/wiki/ICalendar

这里是一个相关的问题:

unable to send meeting request from lotus notes to microsoft exchange using icalendar


2
投票

在使用通过mail.jar使用smtp服务器的情况下,avit.ics是正确的,但是,在这种情况下,它使用内部路由域,并且应该在文档上设置所有数据,因此我们认为多米诺可以转换并发送只是将邮件发送到外部地址。

我只有LotusScript代码,但是它将轻松地将其转换为Java。

Dim invitation As NotesDocument
Dim item As NotesItem
Dim startdttm As NotesDateTime
Dim enddttm As NotesDateTime
Dim rtitem As NotesRichTextItem
Dim prompt As String
Dim language As String
Dim tasktype As String
Dim tmpItem As NotesItem

'Compute SendTo and CopyTo items
Dim SendTo$, CopyTo$

SendTo$ = "[email protected]"
CopyTo$ = ""
language = "en"

Set invitation = New NotesDocument( taskdoc.ParentDatabase )
With invitation
    .ReplaceItemValue "$AltPrincipal", "Automatic Notification <[email protected]>"
    .ReplaceItemValue "$CSVersion", "2"
    .ReplaceItemValue "$CSWISL", Evaluate({@Explode("$S:1;$L:1;$B:1;$R:1;$E:1;$W:1;$O:1;$M:1;RequiredAttendees:1;INetRequiredNames:1;AltRequiredNames:1;StorageRequiredNames:1;OptionalAttendees:1;INetOptionalNames:1;AltOptionalNames:1;StorageOptionalNames:1"; ";")})
    .ReplaceItemValue "$HFFlags", "1"
    .ReplaceItemValue "$IconSwitcher", "Meeting"
    .ReplaceItemValue "$Mailer", "FL Mailer 1.0"
    .ReplaceItemValue "$MiniView", "1"
    .ReplaceItemValue "$NameLanguageTags", "en"
    .ReplaceItemValue "$PublicAccess", "1"
    .ReplaceItemValue "$SMTPKeepNotesItems", "1"
    .ReplaceItemValue "$StorageCc", ""
    .ReplaceItemValue "$StorageTo", "1"
    .ReplaceItemValue "$TableSwitcher", "Description"
    .ReplaceItemValue "$WatchedItems", Evaluate({@Explode("$S;$L;$B;$R;$E;$W;$O;$M;RequiredAttendees;INetRequiredNames;AltRequiredNames;StorageRequiredNames;OptionalAttendees;INetOptionalNames;AltOptionalNames;StorageOptionalNames"; ";")})
    .ReplaceItemValue "AltChair", "Automatic Notification <[email protected]>"
    .ReplaceItemValue "AltCopyTo", ""
    .ReplaceItemValue "AltRequiredNames", SendTo$
    .ReplaceItemValue "AltSendTo", SendTo$
    .ReplaceItemValue "AppointmentType", "3"        
    .ReplaceItemValue "ApptUNID", .UniversalID
    .ReplaceItemValue "Broadcast", "1"
    .ReplaceItemValue "Categories", ""
    .ReplaceItemValue "Chair", "Notifiche Automatiche"
    .ReplaceItemValue "CopyTo", CopyTo$         
    .ReplaceItemValue "CWeSigProcessed", "Y"
    .ReplaceItemValue "Encrypt", "0"
    .ReplaceItemValue "DisplayCopyTo_Icon", "1"
    .ReplaceItemValue "Form", "Notice"      
    .ReplaceItemValue "Importance", "2"     
    .ReplaceItemValue "InetCopyTo", CopyTo$     
    '.ReplaceItemValue "INetFrom", "Automatic Notification"
    .ReplaceItemValue "INetRequiredNames", SendTo$
    .ReplaceItemValue "INetSendTo", SendTo$             
    .ReplaceItemValue "IsBroadcast", "0"
    .ReplaceItemValue "NoticeType", "I"
    .ReplaceItemValue "OnlinePlace", ""
    .ReplaceItemValue "OrgTable", "C0"
    .ReplaceItemValue "PreventCounter", "1"
    .ReplaceItemValue "PreventDelegate", ""
    .ReplaceItemValue "Principal", "Automatic Notification <[email protected]>"
    .ReplaceItemValue "RequiredAttendees", SendTo$
    .ReplaceItemValue "ReturnReceipt", ""
    .ReplaceItemValue "SchedulerSwitcher", "1"
    .ReplaceItemValue "SendTo", SendTo$
    .ReplaceItemValue "SequenceNum", 1
    .ReplaceItemValue "Sign", ""
    .ReplaceItemValue "StorageequiredNames", "1"
    .ReplaceItemValue "STRecordMeeting", ""
    .ReplaceItemValue "Subject", "Broadcast: " + taskdoc.nome(0)
    .ReplaceItemValue "Topic", taskdoc.nome(0)
    .ReplaceItemValue "UpdateSeq", 1
    .ReplaceItemValue "WebDateTimeInit", "1"
    .ReplaceItemValue "_ViewIcon", 133      
End With

Dim tmpDate As NotesDateTime
Dim itemData As NotesItem   
Dim itemOra As NotesItem
Dim itemTemp As NotesItem
Dim appDescription As NotesRichTextItem

Set tmpDate = New NotesDateTime(itemData.Datetimevalue.DateOnly + " " + itemOra.Datetimevalue.TimeOnly)
Call invitation.Replaceitemvalue("CalendarDateTime", tmpDate)
Call invitation.Replaceitemvalue("StartDateTime", tmpDate)
Call invitation.Replaceitemvalue("StartTimeZone", "Z=-1$DO=1$DL=3 -1 1 10 -1 1$ZX=97$ZN=W. Europe") ' FIX WITH CORRECT TIME ZONE

Set tmpDate = New NotesDateTime(itemData.Datetimevalue.DateOnly + " " + itemOra.Datetimevalue.TimeOnly)
Call tmpDate.AdjustHour( 1 , True )
Call invitation.Replaceitemvalue("EndDateTime", tmpDate)
Call invitation.Replaceitemvalue("EndTimeZone", "Z=-1$DO=1$DL=3 -1 1 10 -1 1$ZX=97$ZN=W. Europe") ' FIX WITH CORRECT TIME ZONE

Set tmpDate = New NotesDateTime(itemData.Datetimevalue.DateOnly + " " + itemOra.Datetimevalue.TimeOnly)
Call tmpDate.SetAnyTime
Set itemTemp = invitation.Replaceitemvalue("EndDate", "")
Set itemTemp.DateTimeValue = tmpDate

Set tmpDate = New NotesDateTime(itemData.Datetimevalue.DateOnly + " " + itemOra.Datetimevalue.TimeOnly)
Call tmpDate.AdjustHour( 1 , True )
Call tmpDate.SetAnyDate
Set itemTemp = invitation.Replaceitemvalue("EndTime", "")
Set itemTemp.DateTimeValue = tmpDate    

' NoPurge
invitation.ReplaceItemValue "$NoPurge", invitation.StartDateTime

'Send the invitation and save ApptUNID on the task doc
Call Invitation.Send(False)
If taskdoc.ApptUNID(0) = "" Then
    TaskDoc.ApptUNID = invitation.UniversalID
    Call TaskDoc.Save(True, False)
End If
© www.soinside.com 2019 - 2024. All rights reserved.