AppleScript 用于提取电子邮件 MS Outlook 2016 并将其保存到 Excel



需要帮助弄清楚如何从MS Outlook上的电子邮件中提取内容,并将其保存在MS Excel上。我在下面尝试过,但我无法弄清楚如何选择要从中提取的收件箱的特定电子邮件文件夹。

希望有人能帮忙。

tell application "Microsoft Excel"
set LinkRemoval to make new workbook
set theSheet to active sheet of LinkRemoval
set formula of range "D1" of theSheet to "Message"
set formula of range "C1" of theSheet to "Subject"
set formula of range "B1" of theSheet to "From"
set formula of range "A1" of theSheet to "Date"
end tell

tell application "Microsoft Outlook"
activate
set myAccount to exchange account 2
set theMessages to messages of inbox
set theRow to 2

repeat with aMessage in theMessages
my SetDate(date received of aMessage, theRow, theSheet)
my SetFrom(sender of aMessage, theRow, theSheet)
my SetSubject(subject of aMessage, theRow, theSheet)
my SetMessage(content of aMessage, theRow, theSheet)
set theRow to theRow + 1
end repeat
end tell

on SetDate(theDate, theRow, theSheet)
tell application "Microsoft Excel"
set theRange to "A" & theRow
set formula of rangetheRange of theSheet to theDate
end tell
end SetDate

on SetFrom(theSender, theRow, theSheet)
tell application "Microsoft Excel"
set theRange to "B" & theRow
set formula of rangetheRange of theSheet to theSender
end tell
end SetFrom

on SetSubject(theSubject, theRow, theSheet)
tell application "Microsoft Excel"
set theRange to "C" & theRow
set formula of rangetheRange of theSheet to theSubject
end tell
end SetSubject

on SetMessage(theMessage, theRow, theSheet)
tell application "Microsoft Excel"
set theRange to "D" & theRow
set formula of rangetheRange of theSheet to theMessage
end tell
end SetMessage

试试这个 将帐户设置为用户名为"xxxxx"的第一个交易所帐户

set topFolder to mail folder "Inbox" of theAccount
set subFolder to mail folder "xxxxx" of topFolder


set theMessages to messages of subFolder whose time received > xxxxx

最新更新