Skip to content

Instantly share code, notes, and snippets.

@daicham daicham/gist:1593705

Created Jan 11, 2012
Embed
What would you like to do?
Get Outlook calendar by ruby
require 'win32ole'
def each_meeting
ol = WIN32OLE.connect("Outlook.Application")
myNameSpace = ol.getNameSpace("MAPI")
folder = myNameSpace.GetDefaultFolder(9) # 9 は予定表
#folder.Display
folder.Items.each do |meeting|
GC.start
yield meeting
end
end
each_meeting do |m|
m.Recipients.each do |i|
puts m.Subject + ":" + m.Start + "-" + m.End + "@" + m.Location + ":" + m.Duration.to_s + ":" + m.Body + ":" + i.Name
end
end
@ipstone

This comment has been minimized.

Copy link

ipstone commented Dec 3, 2015

How to filer out the items by date range? I have tried Restrict methods, but it returns OLE error code 4096, and OLE method 'Restrict' is missing. I saw online where people saw similar issue, but no solution yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.