Hello there, I am using (or try to do so) vpim in a rails app to create ics files based upon my own "event"-model and the code below works fine, creates something that looks fine to me, but Apple''s iCal is complaining that it is not valid. Using Mozilla Sunbird to import that file works perfectly fine, but I am wondering what I am missing here. The Code block is the following (show.ics.erb - :ics being registered properly in the mime_types.rb file under config/initializers): <% require ''vpim/icalendar'' cal = Vpim::Icalendar.create2 cal.add_event do |e| e.dtstart @event.starttime e.dtend @event.endtime != nil ? @event.endtime : @event.starttime + 15.minutes e.summary @event.title e.description !@event.description.blank? ? @event.description : "" e.categories [ ''PROJECTS'' ] e.url !@event.url.blank? ? @event.url : "" e.sequence 0 e.access_class "PRIVATE" e.transparency ''OPAQUE'' e.created @event.created_at e.lastmod @event.updated_at e.organizer do |o| o.cn = @user.full_name o.uri = "mailto:#{@user.email}" end attendee = Vpim::Icalendar::Address.create("mailto:#{@user.email}") attendee.rsvp = true e.add_attendee attendee end icsfile = cal.encode %> <%= icsfile %> ... an exemplary output file would be: BEGIN:VCALENDAR VERSION:2.0 PRODID:-//Ensemble Independent//vPim 0.619//EN CALSCALE:Gregorian BEGIN:VEVENT DTSTART:20080505T183000 DTEND:20080505T223000 SUMMARY:test!? DESCRIPTION: CATEGORIES:PROJECTS URL:http://blogwi.se SEQUENCE:0 CLASS:PRIVATE CREATED:20080505T163212 LAST-MODIFIED:20080505T163214 ORGANIZER;CN=Joerg Battermann:mailto:jb at joergbattermann.com ATTENDEE;RSVP=true:mailto:jb at joergbattermann.com END:VEVENT END:VCALENDAR .... hrm. Now what''s wrong here? Anything obvious? Can''t really find anything :-( Best Regards / Mit freundlichen Gruessen, Joerg Battermann -- Freelancer, Entrepreneur, Open Source Advocate E-Mail: jb at joergbattermann.com Cell: +49 179 7861273 Skype: joerg.battermann Web: http://joergbattermann.com ----------------------------------------------------------- Xing Profile: https://www.xing.com/profile/Joerg_Battermann -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/vpim-talk/attachments/20080505/e369182d/attachment-0001.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2427 bytes Desc: not available URL: <http://rubyforge.org/pipermail/vpim-talk/attachments/20080505/e369182d/attachment-0001.bin>
On Mon, May 5, 2008 at 9:48 AM, J?rg Battermann <jb at joergbattermann.com> wrote:> Hello there, > > I am using (or try to do so) vpim in a rails app to create ics files based > upon my own "event"-model and the code below works fine, creates something > that looks fine to me, but Apple''s iCal is complaining that it is not valid. > Using Mozilla Sunbird to import that file works perfectly fine, but I am > wondering what I am missing here.Not having ever used Rails, I can''t actually run your sample code, but I appreciate reading it! Knowing how people use vPim gives me ideas for how to improve it, and some of what you had to do seems uncessarily painful. Anyhow, as for your specific problem, I took your calendar example, saved it in a file, and opened it in "Apple iCal 3.0.2 (1236)". It worked fine, I think Can you try doing that? In what way didn''t it work? If it just refused to parse, maybe Console.app will show some error messages logged by iCal. If opening from a file works, maybe its the MIME type you''ve associated with the data when it gets served using HTTP? Not sure how you make the mapping, but it should be "text/calendar". Thanks, Sam
Sam, oh boy - the ''problem'' was, that the final file had a blank line at the very top. Removing that line helped iCal recognize the content/ data properly and everything works just fine. Really didn''t expect it to be so sensitive. But thanks for the quick reply! Best Regards / Mit freundlichen Gruessen, Joerg Battermann -- Freelancer, Entrepreneur, Open Source Advocate E-Mail: jb at joergbattermann.com Cell: +49 179 7861273 Skype: joerg.battermann Web: http://joergbattermann.com ----------------------------------------------------------- Xing Profile: https://www.xing.com/profile/Joerg_Battermann On May 6, 2008, at 6:30 AM, Sam Roberts wrote:> On Mon, May 5, 2008 at 9:48 AM, J?rg Battermann <jb at joergbattermann.com > > wrote: >> Hello there, >> >> I am using (or try to do so) vpim in a rails app to create ics >> files based >> upon my own "event"-model and the code below works fine, creates >> something >> that looks fine to me, but Apple''s iCal is complaining that it is >> not valid. >> Using Mozilla Sunbird to import that file works perfectly fine, but >> I am >> wondering what I am missing here. > > Not having ever used Rails, I can''t actually run your sample code, but > I appreciate > reading it! Knowing how people use vPim gives me ideas for how to > improve it, and > some of what you had to do seems uncessarily painful. > > Anyhow, as for your specific problem, I took your calendar example, > saved it in > a file, and opened it in "Apple iCal 3.0.2 (1236)". It worked fine, > I think > > Can you try doing that? In what way didn''t it work? If it just refused > to parse, maybe > Console.app will show some error messages logged by iCal. > > If opening from a file works, maybe its the MIME type you''ve > associated with the > data when it gets served using HTTP? Not sure how you make the > mapping, but it > should be "text/calendar". > > Thanks, > Sam > _______________________________________________ > Vpim-talk mailing list > Vpim-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/vpim-talk-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/vpim-talk/attachments/20080506/031a547f/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2427 bytes Desc: not available URL: <http://rubyforge.org/pipermail/vpim-talk/attachments/20080506/031a547f/attachment.bin>
On Tue, May 6, 2008 at 8:17 AM, J?rg Battermann <jb at joergbattermann.com> wrote:> oh boy - the ''problem'' was, that the final file had a blank line at the very > top. Removing that line helped iCal recognize the content/data properly and > everything works just fine. Really didn''t expect it to be so sensitive.Its just following the spec. randomly inserted whitespace is not allowed! Cheers, Sam