Dav*_*vid 5 email icalendar google-calendar-api
I'm trying to create an ICS file to add events to a Google calendar via email. In the end, the calendar will be sent to multiple users, from a desktop app. Ideally I'd like to be able to modify the calendar if the events change (just event times, I'm ignoring cancelled events)
Here is my ICS file
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//MY COMPANY//Calendar//EN
CALSCALE:GREGORIAN
METHOD:PUBLISH
BEGIN:VEVENT
UID:shift-439-emp-128@mycompany.com
DTSTART:20180604T090000
DTEND:20180604T153000
DTSTAMP:20180519T081800
SUMMARY:Morning shfit
LOCATION:Morning Location
DESCRIPTION:Morning shift
END:VEVENT
BEGIN:VEVENT
UID:shift-446-emp-128@mycompany.com
DTSTART:20180605T153000
DTEND:20180605T233000
DTSTAMP:20180519T081800
SUMMARY:Night shift
LOCATION:
DESCRIPTION:Night
END:VEVENT
END:VCALENDAR
Run Code Online (Sandbox Code Playgroud)
When I email that file to my gmail account, I can see a "Add to Google calendar" button which I can use to add the events to my prinary calendar.
Now, say the events times changed.
Question : How can I create a new ICS file with the new times so that existing events will be modified in google calendar?
我将UID用于事件,以便Google不会创建重复的条目。但是,当我通过电子邮件发送具有已修改事件(带有uid)的第二个ics文件时,“添加到Google日历”按钮没有出现。如果我尝试从Google日历“导入”功能手动导入ics文件,则会收到此错误消息
由于您在目标日历上没有足够的访问权限,因此无法上传活动。
如果我每次都设置不同的UID,则导入过程将起作用,但是将创建重复的条目。
我也尝试使用REQUEST代替PUBLISH方法
谢谢
我可以使用以下命令将其与 Gmail 配合使用:
METHOD: 设置REQUESTSEQUENCE:第一次请求时设置0为每次加1ATTENDEE:通过电子邮件地址识别正在接收电子邮件的 Gmail 用户其他变化会产生不良影响:
Office 365 将 ICS 文件发送到可以更新的 Gmail,以便可用于参考商业实施。您可以通过使用 Gmail 中的“显示原始内容”检索 base64 编码的日历正文来查看 Outlook 365 发送的请求。Outlook 365 使用许多其他字段,因此检查它很有启发性。
我有一个使用 SparkPost 的 Go 测试脚本,因此如果您有任何疑问或想使用它,请告诉我。SparkPost 有免费套餐,但您仍然需要配置出站发送域才能使用它。
这是修改请求的示例。我只是增加SEQUENCE并更改时间来更新 Gmail 中的请求。
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//MY COMPANY//Calendar//EN
CALSCALE:GREGORIAN
METHOD:REQUEST
BEGIN:VEVENT
ATTENDEE;ROLE=REQ-PARTICIPANT;CN=example@gmail.com:MAILTO:example@gmail.com
UID:shift-1807-emp-128@mycompany.com
DTSTART:20180807T010000
DTEND:20180807T020000
DTSTAMP:20180601T033455
SEQUENCE:0
SUMMARY:Morning shift
LOCATION:Morning Location
DESCRIPTION:Morning shift
END:VEVENT
BEGIN:VEVENT
ATTENDEE;ROLE=REQ-PARTICIPANT;CN=example@gmail.com:MAILTO:example@gmail.com
UID:shift-1808-emp-128@mycompany.com
DTSTART:20180807T130000
DTEND:20180807T140000
DTSTAMP:20180601T033455
SEQUENCE:0
SUMMARY:Night shift
LOCATION:Night Location
DESCRIPTION:Night
END:VEVENT
END:VCALENDAR
Run Code Online (Sandbox Code Playgroud)
值得注意的是,在我的测试中,当在单个 ICS 文件中发送多个事件时,Gmail 有时需要一秒钟左右的时间才能显示两个事件的正确时间。