AppleScript script to Save MS Outlook Attachments Including their Original Creation or Modification Dates in the File Name (On a Mac Computer): I would like to have the script save the attachment so that its file name includes the original date of creation (or modification) of the document (Not the date when I received the attachment), e.g., This_is_my_document_Originally_Created_on_2020_01_01.pdf. Below is the code I’ve developed so far. Any help would be highly appreciated.
tell application "Microsoft Outlook"
set msgs to current messages
set myDocumentFolder to POSIX path of (path to documents folder as string)
repeat with msg in msgs
set this_attachment to attachment of msg
set subj to subject of msg
set msgSubject to subj as string
set saveToFolder to myDocumentFolder & msgSubject
tell application "Finder"
if not (exists saveToFolder) then
do shell script "mkdir -p " & quoted form of saveToFolder
end if
end tell
save msg in saveToFolder
save this_attachment in saveToFolder
end repeat
end tell
Model: MacBook Pro 2016
AppleScript: 2.11 (208) (AppleScript 2.7)
Browser: Safari Version 14.0.3 (15610.4.3.1.7, 15610)
Operating System: macOS 10.14