一千萬個為什麽

搜索

Google日歷無法讀取ICalendar。

操作系統:WinXP 您用於訪問Google日歷的程序和版本(FF3.5):

我正在開發一個腳本(基於我在網上找到的現有vCal ASP.NET類)來生成.ics文件。導入到Outlook 2003時,此文件可以正常工作。當我嘗試導入到Google日歷時,出現以下錯誤:

無法導入事件:無法處理您的iCal/CSV文件..

我不太了解vCal格式或語法,但一切看起來都不錯。我將在下面發布示例測試日歷.ics:

BEGIN:VCALENDAR
PRODID:-//jpalm.se//iCalendar example with ASP.NET MVC//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:PUBLISH
X-MS-OLK-FORCEINSPECTOROPEN:TRUE
BEGIN:VEVENT
DTSTART:20100304T000000Z
DTEND:20100304T000000Z
TRANSP:OPAQUE
SEQUENCE:0
UID:7c9d6dd7-41f2-4171-8ae4-35820974efa4

DESCRIPTION:uba:Project20100321:sagar .

SUMMARY:First Milestone
END:VEVENT
X-MS-OLK-FORCEINSPECTOROPEN:TRUE
BEGIN:VEVENT
DTSTART:20100330T230000Z
DTEND:20100330T230000Z
TRANSP:OPAQUE
SEQUENCE:0
UID:8a982519-b99b-429a-8dad-c0f95c50d0e6

DESCRIPTION:uba:Project20100321:imanage2010 pm

SUMMARY:upcoming milestones
END:VEVENT
X-MS-OLK-FORCEINSPECTOROPEN:TRUE
BEGIN:VEVENT
DTSTART:20100329T230000Z
DTEND:20100329T230000Z
TRANSP:OPAQUE
SEQUENCE:0
UID:588750a1-6f10-4b5d-8a51-3f3818024726

DESCRIPTION:uba:Project20100321:sagar .

SUMMARY:test
END:VEVENT
X-MS-OLK-FORCEINSPECTOROPEN:TRUE
BEGIN:VEVENT
DTSTART:20100407T230000Z
DTEND:20100407T230000Z
TRANSP:OPAQUE
SEQUENCE:0
UID:36eaa726-a0a0-40a1-ba7c-09857f8ed006

DESCRIPTION:uba:Project20100321:imanage2010 pm

SUMMARY:Rad apps devs
END:VEVENT
X-MS-OLK-FORCEINSPECTOROPEN:TRUE
BEGIN:VEVENT
DTSTART:20100408T125632Z
DTEND:20100408T125632Z
TRANSP:OPAQUE
SEQUENCE:0
UID:8521ad53-916a-43cc-8eeb-42c1b3d670d3

DESCRIPTION:uba:Project20100321:imanage2010 pm

SUMMARY:this is a test ms
END:VEVENT
X-MS-OLK-FORCEINSPECTOROPEN:TRUE
BEGIN:VEVENT
DTSTART:20100415T125643Z
DTEND:20100415T125643Z
TRANSP:OPAQUE
SEQUENCE:0
UID:e4b295d8-2271-4393-9899-3e9c858f4e8c

DESCRIPTION:uba:Project20100321:imanage2010 pm

SUMMARY:Test msssss
END:VEVENT
X-MS-OLK-FORCEINSPECTOROPEN:TRUE
BEGIN:VEVENT
DTSTART:20100430T055201Z
DTEND:20100430T055201Z
TRANSP:OPAQUE
SEQUENCE:0
UID:1e464698-1064-4cb2-8166-2a843b63ca5a

DESCRIPTION:uba:Project20100321:imanage2010 pm

SUMMARY:this is a new milestones for testing on 30th april
END:VEVENT
X-MS-OLK-FORCEINSPECTOROPEN:TRUE
BEGIN:VEVENT
DTSTART:20100731T093917Z
DTEND:20100731T093917Z
TRANSP:OPAQUE
SEQUENCE:0
UID:5262ef58-73bc-4d66-a207-4e884e249629

DESCRIPTION:uba:Project20100321:imanage2010 pm

SUMMARY:555555555555555555
END:VEVENT
X-MS-OLK-FORCEINSPECTOROPEN:TRUE
BEGIN:VEVENT
DTSTART:20100328T230000Z
DTEND:20100328T230000Z
TRANSP:OPAQUE
SEQUENCE:0
UID:f654262d-714e-41d9-9690-005bb467f8aa

DESCRIPTION:uba:Untitled project:imanage2010 pm

SUMMARY:first milestone
END:VEVENT
X-MS-OLK-FORCEINSPECTOROPEN:TRUE
BEGIN:VEVENT
DTSTART:20100401T095537Z
DTEND:20100401T095537Z
TRANSP:OPAQUE
SEQUENCE:0
UID:3f4a6c16-f460-457d-a281-b4c010958796

DESCRIPTION:uba:ProjectIcal:imanage2010 pm

SUMMARY:new ms ical
END:VEVENT
X-MS-OLK-FORCEINSPECTOROPEN:TRUE
BEGIN:VEVENT
DTSTART:20100331T230000Z
DTEND:20100331T230000Z
TRANSP:OPAQUE
SEQUENCE:0
UID:e5bf28d1-3559-48e9-90f8-2b5233489a13

DESCRIPTION:uba:ProjectIcal:imanage2010 pm

SUMMARY:new ms 2 ical
END:VEVENT
END:VCALENDAR

生成上面代碼的源代碼就是mvc視圖::


"%>
BEGIN:VCALENDAR
VERSION:2.0 1)
             {%>
CALSCALE:GREGORIAN
METHOD:PUBLISH
X-MS-OLK-FORCEINSPECTOROPEN:TRUE

BEGIN:VEVENT
DTSTART
DTEND
TRANSP:OPAQUE
SEQUENCE:0
UID:
DESCRIPTION:
SUMMARY:
END:VEVENT
END:VCALENDAR

最佳答案

ical feed的問題在於,不同的日歷對於不同的東西都很挑剔,而且至少在我看來,這個規範有點難以理解。但是, Kanzaki 可以很好地為像我這樣的程序員制定規範。

現在,你的feed feed還需要精確到換行符(Apple的不會導入最後錯誤的換行符)並且我發現這3個驗證器的組合效果最好:

最嚴格的驗證器實際上對我有誤報(即,它根據規範報告了實際上沒有錯誤的錯誤),但是前兩個沒有發現錯誤,這就是為什麽我建議通過所有三個運行您的Feed他們

轉載註明原文: Google日歷無法讀取ICalendar。