Created
January 11, 2012 08:25
-
-
Save daicham/1593705 to your computer and use it in GitHub Desktop.
Get Outlook calendar by ruby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.