0
votes

I'm using AppleScript to iterate (using a repeater) through messages in an Outlook folder, and I can access TIME RECEIVED on the first iteration, but on subsequent iterations TIME RECEIVED is "Missing Value"

Pared code down to problem area, still repros error. Using MacOS Mohave 10.14.4, Office 365 for Mac/Home version, Outlook v16.25

tell application "Microsoft Outlook"
    set msgs to messages of folder "Sent" of default account
    repeat with msg in msgs
        set messageTime to time received of msg
        set y to year of messageTime -- 1st time through is OK, each add'l time says missing value
        display notification "" & y
        delay 1
    end repeat
end tell

Actual error message in Script Editor is "Can't get year of missing value".

Tried switching inbox vs. sent, same problem.

1

1 Answers

0
votes

My mistake - should've used TIME SENT, not TIME RECEIVED. And I'm not checking for null (rookie mistake!) :)

set messageTime to time received of msg

should be:

set messageTime to time sent of msg