Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Create an Outlook iCalendar entry?

by traveler (Parson)
on Jun 28, 2006 at 22:53 UTC ( [id://558182]=perlquestion: print w/replies, xml ) Need Help??

traveler has asked for the wisdom of the Perl Monks concerning the following question:

I tried this to create an iCalendar entry that Outlook could read:
use Data::ICal; use Data::ICal::Entry::Event; use Date::ICal; use strict; my $calendar = Data::ICal->new(); my $vtodo = Data::ICal::Entry::Event->new(); $vtodo->add_properties( summary => "some fun", description => "a fun thing to do", dtstart => Date::ICal->new ( day => 29, month => 6, year => 2006, hour => 7, min => 15, sec => 00 )->ical, dtend => Date::ICal->new(day => 29, month => 6, year => 2006, hour => 7, min => 45, sec => 00 )->ical, ); $calendar->add_entry($vtodo); print $calendar->as_string;
The entry looks like this:
BEGIN:VCALENDAR PRODID:Data::ICal 0.07 VERSION:2.0 BEGIN:VEVENT DESCRIPTION:a fun thing to do DTEND:20060629T134500Z DTSTART:20060629T131500Z SUMMARY:some fun END:VEVENT END:VCALENDAR
Which looks reasonable to me. Outlook says "The operation failed." when I put the output into an ics file and import it. Ideas?

Replies are listed 'Best First'.
Re: Create an Outlook iCalendar entry?
by planetscape (Chancellor) on Jun 29, 2006 at 11:49 UTC

    I'll freely admit that I don't have much of a clue here, but I hate seeing nodes go unanswered. I started with Google (Outlook iCalendar "visual basic" MVP) ("visual basic" because VB is generally very easy to translate to Perl and examples should abound, and "MVP" because MS Most Valuable Players usually know what they are talking about), and found this page: Using PHP to Make Basic vCalendar/iCalendar Events, which seems promising because it has a couple examples of vCalendar files as well as several links on iCalendar/vCalendar specs. A purely visual comparison of your iCalendar file and their sample suggests a couple ideas you might try:

    • Check whether you need to escape colons, as in PRODID:Data::ICal 0.07
    • Perhaps Outlook is picky about start date coming before end date?

    I'm shooting in the dark here, but I do hope this helps... Good luck!

    Update: Advanced Perl Programming, 2nd Ed. has an example in Chapter 2: Parsing Techniques, on getting information out of iCal; the author, Simon Cozens, mentions a module called Net::ICal, used "to read and write iCalendar data." Perhaps that module may help you, although it does sound like he's using it with Apple's version of iCalendar...

    planetscape
Re: Create an Outlook iCalendar entry?
by Asim (Hermit) on Jun 29, 2006 at 14:16 UTC

    A couple of years ago, I tried to create ICal files using Data::ICal, and failed when loading into Outlook. Outlook is, it seems, once again not compatible with a standard, in this case the ICal RFC.

    I ended up creating the file manually in Perl, by reverse-engineering the ICal files that Outlook produces, sussing out the basic format from these, and testing my output files. I don't have that code handy, but a similar process should produce ICals that Outlook likes. If you really want a look at my code, respond or msg me, and I'll post it.

    ----Asim, known to some as Woodrow.

    A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://558182]
Approved by GrandFather
Front-paged by tye
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (7)
As of 2024-04-19 13:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found