Accessing Outlook folders, other than Inbox

Hi Dossy,
This is a good enough starting point. Thanks.

Barry

···

Can someone tell me how to access other Outlook folders
using win32ole?

Barry,

This is a fairly ugly way to do it, but it works for me:

require 'win32ole'

o = WIN32OLE.new("Outlook.Application")

ns = o.GetNamespace("MAPI")
cf = ns.GetDefaultFolder(9)
e = o.Explorers.Add(cf, 2)

items = cf.Items
(1 .. items.Count).each { |n|
  item = items.Item(n)
  puts "#{item.Start}: #{item.Subject}"
}

# Shut down Outlook process.
e.Close

This iterates over all the appointments you have defined
in your Calendar.

This may not be helpful, but it might give you some
ideas …

– Dossy


Dossy Shiobara mail: dossy@panoptic.com
Panoptic Computer Network web: http://www.panoptic.com/
“He realized the fastest way to change is to laugh at your own
folly – then you can let go and quickly move on.” (p. 70)