[Ruby] GroupWise export to iCal

UPDATE: I’ve posted a more complete version of this code in More Ruby Exporting of Groupwise to iCal.

I’ve wanted to export my Groupwise calendar to iCal format for a long time. Every time I try to do it, I ended up running into the same few pages. They sorta worked, but were clumsy.

So I threw this little beauty together in under 10 minutes and 2 google searches. It seems to be a start, though I expect to improve it. Groupwise Object API Docs (PDF format; the web version keeps blinking — arrrgh) from Novell were useful, as was this Ruby gem.

require win32ole
require icalendar

groupwise = WIN32OLE.new(NovellGroupWareSession)
# 2nd arg is not password, so leave blank
account = groupwise.Login(your-username, )
path_to_host = account.PathToHost
cal = Icalendar::Calendar.new
account.Calendar.Messages.each do |message|
  next unless message.ClassName == GW.MESSAGE.APPOINTMENT
  event = cal.event  # This automatically adds the event to the calendar
  event.user_id = tims@asrs.state.az.us
  event.timestamp = DateTime.now
  event.summary = message.subject.PlainText
  event.description = message.BodyText.PlainText
  event.start = message.StartDate
  event.end = message.EndDate
end

puts cal.to_ical

Every day I find more reasons to love using Ruby. Enjoy!

8 Responses to “[Ruby] GroupWise export to iCal”

  1. Jenine Says:

    I was wondering if you wrote this for use on Windows or Mac.

  2. tim Says:

    I was on a Windows box at the time I wrote it; though I’m sure I was wishing I was using a Mac. :-)

  3. Matthias Says:

    need to get my groupwise calendar data into ical. How do I get this little programm run on a windows based Groupwise client??

  4. jon Says:

    Would you mind explaining a little about what you did AFTER you ran this? The resulting output doesn’t seem to jive with Sunbird or other iCalendar apps when simply copied and pasted into an .ics file. Did you have to adjust the data in some way?

  5. Adam Says:

    Tim,

    You suggest that this script is a good start and you plan to improve it. I tried it out, and like jon, found that there’s something not quite right with the iCal file this script creates (Google Calendar won’t import it). Have you made any improvements to this script, or has it fallen by the wayside to bigger and better (or newer and neater) projects?

    I’m not asking you to continue development (though I wouldn’t mind if you did ;-) … I just want to know if the work has already been done before I give it a go.

    Thanks!

  6. tim Says:

    I’m pretty sure I did improve the script. I’ve made a note to search around for it. If you don’t hear from me within the next week, give me a ping. :-)

  7. Adam Says:

    Hi Tim,

    just following up on the ruby script to export Groupwise to iCal. I can check back with you again after the holidays, no need to find it before. Take care!

    Adam

  8. Zdot » Blog Archive » More Ruby Exporting of Groupwise to iCal Says:

    [...] One of my most frequently requested posts is my initial exploration into using Ruby to export my Groupwise calendar to iCal format. The code I posted there was simple, and it almost worked. I figured that’d be the jumping off point for a lot of people to dive in and explore the options Ruby has from there. In retrospect, though, I should also have posted my final version that I worked out a few weeks later. [...]

Leave a Reply