我們有一個用java編寫的系統,它將iCal事件發送給客戶端。在某些Outlook客戶端顯示2小時後發生的ical事件
一位客戶有一個問題,即從iCal(VCALENDAR)內容中指定,我們系統發送的所有事件在其展望中延遲2小時。
客戶確保他們的電腦上正確設置了timzone,所以中歐時間。我們已經在我們的電子郵件客戶端內部和我們的客戶端(主要是Outlook)測試了相同的事件,事件被正確顯示。
我們使用iCal4J構造MIME消息。是否有任何參數需要額外設置才能提高不同客戶端上事件的時間精度?
例如,下列事件設定爲10:00至12:00,但我們的客戶在其展望中表示爲12:00至14:00,在我們的展望中,同一事件顯示正確。
這裏是我們的活動主體的實例:
From: =?UTF-8?Q?Tanja_Bla=C5=BEi=C4=8D?= <******@****.***>
To: Petra Lunder <******.******@******.***>
Message-ID: <15605406.0.1409569454863.JavaMail."****.*****"@*******>
Subject: test sestankov - testni sestanek 1
MIME-Version: 1.0
Content-Type: text/calendar; method=REQUEST; charset="utf-8"
Content-Transfer-Encoding: 8bit
BEGIN:VCALENDAR
PRODID:-//4pm - Arctur d.o.o.//iCal4j 1.0//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:REQUEST
BEGIN:VEVENT
DTSTAMP:20140901T110414Z
DTSTART:20140912T100000
DTEND:20140912T120000
SUMMARY:test sestankov - testni sestanek 1
TZID:Europe/Prague
ORGANIZER;CN=Tanja Blažič:mailto:********@***********
LOCATION:
DESCRIPTION:testni sestanek\n---------------------------------------\nsta
tus dogodka: potrjen\n---------------------------------------\ntrenutno
stanje udeležbe na dogodku\n-------------------------------------\nPetra
Lunder - nedoločeno\nSimon Cigoj - nedoločeno\nVesna Kobal - nedoločeno
\n
SEQUENCE:0
UID:[email protected]_4pm_a
STATUS:CONFIRMED
ATTENDEE;ROLE=REQ-PARTICIPANT;RSVP=TRUE;CN=Petra Lunder;PARTSTAT=NEEDS-AC
TION:mailto:******.******@*****.**
ATTENDEE;ROLE=REQ-PARTICIPANT;RSVP=TRUE;CN=Simon Cigoj;PARTSTAT=NEEDS-ACT
ION:mailto:******.******@*****.**
ATTENDEE;ROLE=REQ-PARTICIPANT;RSVP=TRUE;CN=Vesna Kobal;PARTSTAT=NEEDS-ACT
ION:mailto:******.******@*****.**
END:VEVENT
END:VCALENDAR
我的Java ical4j代碼:
DateTime start = new DateTime(_startDate);
DateTime end = new DateTime(_endDate);
//meeting = new VEvent(start, end, StringUtilities.clearLatinLetters(_sumamry));
meeting = new VEvent(start, end, _sumamry);
TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry();
VTimeZone tz = registry.getTimeZone(LocaleUtil.getTimeZoneID()).getVTimeZone();
Organizer $organizer = new Organizer(URI.create("mailto:" + _organizerEmail));
$organizer.getParameters().add(new Cn(_organizerName));
meeting.getProperties().add($organizer);
Location $location = new Location(_location);
meeting.getProperties().add($location);
Description $description = new Description(_description);
meeting.getProperties().add($description);
meeting.getProperties().add(new Sequence(Integer.parseInt(_sequence + "")));
meeting.getProperties().add(new Uid(_customerEventId));
calendar = new Calendar();
// $calendar.getProperties().add(new ProdId("-//Ben Fortuna//iCal4j 1.0//EN"));
calendar.getProperties().add(new ProdId("-//4pm - Arctur d.o.o.//iCal4j 1.0//EN"));
calendar.getProperties().add(Version.VERSION_2_0);
calendar.getProperties().add(CalScale.GREGORIAN);
calendar.getProperties().add(_method.toIcal4j());
calendar.getComponents().add(meeting);
calendar.getComponents().add(tz);
嗯一個如何使用ical4j? – simonC 2014-09-08 07:31:25
從未使用過ical4j,但這似乎解決了這個問題:http://wiki.modularity.net.au/ical4j/index.php?title=Timezones#Referencing_the_default_registry – oberron 2014-09-15 05:01:14