0

Outlook Inboxを繰り返したいのですが、Rubyを使用しています。

ここでいくつかの有用な情報を見つけましたが、受信トレイ内のメッセージの順序はRecevedTime(Item OLEオブジェクトのプロパティ)によって順序付けられていません。GetLastメソッドは最新のメッセージを見つける可能性がありますが、GetPreviousメソッドは期待どおりに機能しません。

require 'win32ole'

outlook = WIN32OLE.new('Outlook.Application')
mapi    = outlook.GetNameSpace('MAPI')
inbox   = mapi.GetDefaultFolder(6)

inbox.Items.GetLast # return the latest message, maybe
inbox.Items.GetPrevious # return nil object and then, what's this method for?
inbox.Items.Sort('ReceivedTime')    # is this right usage? if so, what's next?

Inbox内のメッセージを最新のものから最も古いものへと繰り返すにはどうすればよいですか?

4

1 に答える 1

0
require 'win32ole'

ol = WIN32OLE.new('Outlook.Application')
class OC; end
WIN32OLE.const_load(ol, OC)

mapi = ol.GetNameSpace("MAPI")
inbox = mapi.GetDefaultFolder(OC::OlFolderInbox)
items = inbox.items
items.sort('ReceivedTime', OC::OlAscending)

items.getfirst
items.getnext

items.getlast
items.getprevious
于 2011-01-05T08:44:32.190 に答える