メールのMessage-Idを一覧表示させる必要ができたので、そのメモ。 OutlookのVBAにはMessage-Idを直接取得するためのプロパティが用意されていない。何やらCDOを使ってMAPIを呼び出すとか、Redemptionというツールを使う必要があるらしい。Outlook TipsというサイトにMAPIを利用したサンプルが掲載されていた(動作は未確認)。 これに比べて、Mac OS XのMail.appはすごく簡単。Message-IdをAppleScriptから直接取得できる。以下は、Mac OS Xに収録されていたMail.app用サンプルスクリプトをちょこっといじったもの。Mail.app上でメールを選択しスクリプトを実行すると、ダイアログにMessage-Idのリストが表示される(利用は自己責任で)。
using terms from application "Mail"on perform mail action with messages selectedMsgs-- See Mail's AppleScript dictionary for the full documentation on the-- 'perform mail action with messages' handler.set logString to ""tell application "Mail"set selCount to (count of selectedMsgs)repeat with counter from 1 to selCountset msg to item counter of selectedMsgsset theMessageID to "Message-Id: <" & message id of msg & ">"set logString to (logString & return & theMessageID)end repeatend tellif length of logString > 0 thendisplay dialog "Message-Idのリスト" default answer logStringend ifend perform mail action with messagesend using terms from
using terms from application "Mail"on runtell application "Mail" to set sel to selectiontell me to perform mail action with messages (sel)end runend using terms from
コメント