ICS更新在Google日历中不起作用

ICS更新在Google日历中不起作用

本文介绍了Icalendar ICS更新在Google日历中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Gmail/Google日历地址的ICS附件有一些麻烦.当我必须编辑事件时,我会通过邮件发送带有ICS文件的更新,该文件具有与原始事件相同的UID.但是,GCalendar添加了第二个事件.我该如何克服?

I have some trouble with the ICS attachment to Gmail/Google calendar addresses.When I have to edit an event I send an update by mail with an ICS file with the same UID of the original event. However, GCalendar adds a second event. How can I overcome this?

这是第一个ICS文件内容:

This is first ICS file content:

BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:REQUEST
BEGIN:VEVENT
DTSTART:20130425T090000
DTEND:20130425T100000
DTSTAMP:20130206T101100
ORGANIZER;CN=Test test:mailto:[email protected]
ATTENDEE:[email protected]
UID:CALEVENT_TS090519840000000005
DESCRIPTION:test
SUMMARY:test
LOCATION:Test
SEQUENCE:1
STATUS:CONFIRMED
END:VEVENT
END:VCALENDAR

这是更新ICS文件的内容:

And this is the update ICS file content:

BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:REQUEST
BEGIN:VEVENT
DTSTART:20130425T100000
DTEND:20130425T110000
DTSTAMP:20130206T101100
ORGANIZER;CN=Test test:mailto:[email protected]
ATTENDEE:[email protected]
UID:CALEVENT_TS090519840000000005
DESCRIPTION:test
SUMMARY:test
LOCATION:Test
SEQUENCE:2
STATUS:CONFIRMED
END:VEVENT
END:VCALENDAR

当我收到更新文件并单击将此事件添加到日历"时,我将找到两个不同的事件.

When I receive the update files and I click on "add this event to calendar" I will find two different events.

这是原始原始电子邮件:

This is the original raw email:

Delivered-To: [email protected]
Received: by 10.216.231.19 with SMTP id k19csp190640weq;
        Sat, 9 Feb 2013 08:01:11 -0800 (PST)
X-Received: by 10.194.7.136 with SMTP id j8mr15530679wja.38.1360425671327;
        Sat, 09 Feb 2013 08:01:11 -0800 (PST)
Return-Path: <[email protected]>
Received: from mxavas8.aruba.it (mxavas8.aruba.it. [62.149.157.18])
        by mx.google.com with SMTP id 45si59706250eeg.83.2013.02.09.08.01.11;
        Sat, 09 Feb 2013 08:01:11 -0800 (PST)
Received-SPF: neutral (google.com: 62.149.157.18 is neither permitted nor denied by best guess record for domain of [email protected]) client-ip=62.149.157.18;
Authentication-Results: mx.google.com;
       spf=neutral (google.com: 62.149.157.18 is neither permitted nor denied by best guess record for domain of [email protected]) [email protected]
Received: (qmail 4991 invoked by uid 89); 9 Feb 2013 16:01:10 -0000
Delivered-To: [email protected]
Received: (qmail 4424 invoked by uid 89); 9 Feb 2013 16:01:04 -0000
Received: from unknown (HELO mxcmd03.ad.aruba.it) (10.10.10.67)
  by mxavas8.ad.aruba.it with SMTP; 9 Feb 2013 16:01:04 -0000
Received: from smtpdg11.aruba.it ([62.149.158.229])
    by mxcmd03.ad.aruba.it with bizsmtp
    id yFwi1k01A4xF4Fy01G14N7; Sat, 09 Feb 2013 17:01:04 +0100
Received: from localhost ([79.54.181.227])
    by smtpcmd04.ad.aruba.it with bizsmtp
    id yG141k0074umbYX01G140P; Sat, 09 Feb 2013 17:01:04 +0100
Date: Sat, 9 Feb 2013 17:01:04 +0100
Return-Path: [email protected]
To: [email protected]
From: Event notification <[email protected]>
Reply-To: Event notification <[email protected]>
Subject: New Event
Message-ID: <238497c6d05cffae45716486e74a8009@localhost>
X-Priority: 3
X-Mailer: PHPMailer 5.2.2 (http://code.google.com/a/apache-extras.org/p/phpmailer/)
MIME-Version: 1.0
Content-Type: multipart/mixed;
    boundary="b1_238497c6d05cffae45716486e74a8009"
X-Spam-Rating: mxavas8.ad.aruba.it 1.6.2 0/1000/N

--b1_238497c6d05cffae45716486e74a8009
Content-Type: multipart/alternative;
    boundary="b2_238497c6d05cffae45716486e74a8009"

--b2_238497c6d05cffae45716486e74a8009
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

test

        DateTimeRoom
        02/05/201309.00 - 10.15ROOM1


--b2_238497c6d05cffae45716486e74a8009
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;">
<style type="text/css">
<!--
    td{ background-color: #eee; }
-->
</style>
</head>
<body style="font-family: Arial, Helvetica, sans-serif; color: #333;">
<p style="text-align:center;"><img src="images/logo2.png" alt="Logo" /></p>
<hr style="border: 1px solid #ccc; width: 80%;" />
<div style=" width: 80%; margin: 10px auto;">
    <h4></h4>
    <h3>test</h3>
    <table style="width: 400px; table-layout: fixed; border: 1px solid #ccc;">
        <tr><th>Date</th><th>Time</th><th>Room</th></tr>
        <tr><td>02/05/2013</td><td>09.00 - 10.15</td><td>ROOM 1</td></tr>
    </table>
</div>
</body>
</html>



--b2_238497c6d05cffae45716486e74a8009--

--b1_238497c6d05cffae45716486e74a8009
Content-Type: text/calendar; name="event.ics"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="event.ics"

BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
PRODID:tsCalendar
METHOD:REQUEST
BEGIN:VEVENT
DTSTART:20130502T090000
DTEND:20130502T101500
DTSTAMP:20130209T170100
ORGANIZER:mailto:[email protected]
ATTENDEE:mailto:[email protected]
UID:CALEVENT_TS090519840000000013
DESCRIPTION:test
SUMMARY:test
LOCATION:ROOM1 (floor: prova)
SEQUENCE:1
STATUS:CONFIRMED
END:VEVENT
END:VCALENDAR


--b1_238497c6d05cffae45716486e74a8009--

以下是带有ORGANIZER电子邮件与发件人电子邮件和ATTENDEE电子邮件与收件人电子邮件相同的其他测试.

Here are the other tests with the ORGANIZER email the same as the Sender email and ATTENDEE email the same as Receiver email.

创建 http://tny.cz/6396ba62 更新 http://tny.cz/08ac81c0

推荐答案

请参阅RFC5546 更新事件

see RFC5546 Update an Event

在您的情况下,鉴于共享的内容,您可能需要在ical文件中添加一个SEQUENCE属性,并在每次进行更新时增加它.

in your case given what you shared you probably need to add a SEQUENCE property in your ical file and increment it for every update you make.

更新:给定您添加的ical文件,您将丢失组织者和与会者字段,而下面的文件将进行更新工作

Update:given the ical file you added, you are missing the organiser and attendee fields with below file the update work

BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
PRODID:pyICSParser
METHOD:REQUEST
BEGIN:VEVENT
DTSTART:20130425T090000
DTEND:20130425T100000
DTSTAMP:20130206T101100
ORGANIZER:mailto:[email protected]
ATTENDEE:mailto:[email protected]
UID:CALEVENT_TS090519840000000005
DESCRIPTION:test
SUMMARY:test
LOCATION:Test
SEQUENCE:1
STATUS:CONFIRMED
END:VEVENT
END:VCALENDAR

此外,您还需要将发件人的电子邮件地址与组织者的电子邮件地址进行匹配,并且与参加者的电子邮件地址相同,如下所示的内容已通过Google日历进行了验证.

Also you need to match the email address of the sender with the one from organiser and same about the attendee, something like below has been validated with google calendar.

eml_as_string:

eml_as_string:

Subject: New Event
Message-ID: <238497c6d05cffae45716486e74a8009@localhost>
X-Priority: 3
X-Mailer: PHPMailer 5.2.2 (http://code.google.com/a/apache-extras.org/p/phpmailer/)
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="b1_238497c6d05cffae45716486e74a8009"
X-Spam-Rating: mxavas8.ad.aruba.it 1.6.2 0/1000/N

--b1_238497c6d05cffae45716486e74a8009
Content-Type: multipart/alternative;
boundary="b2_238497c6d05cffae45716486e74a8009"

--b2_238497c6d05cffae45716486e74a8009
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

test

DateTimeRoom
02/05/201309.00 - 10.15ROOM1


--b2_238497c6d05cffae45716486e74a8009
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;">
<style type="text/css">
<!--
td{ background-color: #eee; }
-->
</style>
</head>
<body style="font-family: Arial, Helvetica, sans-serif; color: #333;">
<p style="text-align:center;"><img src="images/logo2.png" alt="Logo" /></p>
<hr style="border: 1px solid #ccc; width: 80%;" />
<div style=" width: 80%; margin: 10px auto;">
<h4></h4>
<h3>test</h3>
<table style="width: 400px; table-layout: fixed; border: 1px solid #ccc;">
    <tr><th>Date</th><th>Time</th><th>Room</th></tr>
    <tr><td>02/05/2013</td><td>09.00 - 10.15</td><td>ROOM 1</td></tr>
</table>
</div>
</body>
</html>



--b2_238497c6d05cffae45716486e74a8009--

--b1_238497c6d05cffae45716486e74a8009
Content-Type: text/calendar; name="event.ics"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="event.ics"

BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
PRODID:tsCalendar
METHOD:REQUEST
BEGIN:VEVENT
DTSTART:20130502T090000
DTEND:20130502T101000
DTSTAMP:20130209T170100
ORGANIZER:mailto:[email protected]
ATTENDEE:mailto:[email protected]
UID:CALEVENT_TS090519840000000013
DESCRIPTION:test
SUMMARY:test
LOCATION:ROOM1 (floor: prova)
SEQUENCE:1
STATUS:CONFIRMED
END:VEVENT
END:VCALENDAR


--b1_238497c6d05cffae45716486e74a8009--

在其上应用了以下脚本:

on which below script was applied:

# -*- coding:utf-8 -*-
import smtplib
def sendInvite(fro,to,emlasstring):
    mailServer = smtplib.SMTP('smtp.gmail.com', 587)
    mailServer.ehlo()
    mailServer.starttls()
    mailServer.ehlo()
    mailServer.login(login, password)
    mailServer.sendmail(fro, to, emlasstring)
    mailServer.close()

newUID = "UID:newCALEVENT_TS090519840000000016"
#needed to change UID as once an event was sent its UID is locked and a few attempts were needed to make the script work
eml = open("SO14712929_1.eml",'r').read()
emlhead = "To: "+attendee_eml+CRLF
emlhead += "From:"+fro+CRLF
emlhead += "Reply-To: "+fro+CRLF
eml = emlhead+eml
eml = eml.replace("ORGANIZER:mailto:[email protected]","ORGANIZER:mailto:"+fro_eml)
eml = eml.replace("ATTENDEE:mailto:[email protected]","ATTENDEE:mailto:"+attendee_eml)
eml = eml.replace("UID:CALEVENT_TS090519840000000013",newUID)
sendInvite(fro,attendees,eml)
print "invite sent"

eml = open("SO14712929_2.eml",'r').read()
emlhead = "To: "+attendee_eml+CRLF
emlhead += "From:"+fro+CRLF
emlhead += "Reply-To: "+fro+CRLF
eml = emlhead+eml
eml = eml.replace("ORGANIZER:mailto:[email protected]","ORGANIZER:mailto:"+fro_eml)
eml = eml.replace("ATTENDEE:mailto:[email protected]","ATTENDEE:mailto:"+attendee_eml)
eml = eml.replace("UID:CALEVENT_TS090519840000000013",newUID)
sendInvite(fro,attendees,eml)
print "updated invite sent"

这篇关于Icalendar ICS更新在Google日历中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 21:10