Thanks to all and “yes” to Paul, it’s IMAP (exchange server).
If it's an Exchange account, the line
set theAcct to IMAP account "My IMAP Account"
will work in Entourage X, but you should change it to
set theAcct to Exchange account "My Exchange Account" -- or whatever the name is
and also change the next line
set oldMsgs to (every message of IMAP inbox folder of theAcct whose time received is less than cutoff)
to
set oldMsgs to (every message of folder "INBOX" of theAcct whose time received is less than cutoff) -- or whatever it's name is
so it will also work when you upgrade to Entourage 2004. (However, in 2004, there will actually be an easier and faster way to do this, for IMAP as well, so ask again when Office 2004 is released.)
--------------------------------------------------------------
set cutoff to ((current date) - (30 * days))
tell application "Microsoft Entourage"
set theAcct to IMAP account "My IMAP Account"
set oldMsgs to (every message of IMAP inbox folder of theAcct whose time received is less than cutoff)
repeat with i from (count oldMsgs) to 1 by -1
set theMsg to item i of my oldMsgs
set {msgProps, theLinks} to theMsg's {properties, links}
set {theSource, timeReceived, ifRepliedTo, ifForwarded, ifRedirected, ifFlagged, ifRead, thePriority, theCategories} to msgProps's {source, time received, replied to, forwarded, redirected, flagged, read status, priority, category}
set dupMsg to make new incoming message at folder "Test" with properties {account:theAcct, source:theSource, time received:timeReceived, replied to:ifRepliedTo, forwarded:ifForwarded, redirected:ifRedirected, flagged:ifFlagged, read status:ifRead, priority:thePriority, category:theCategories}
repeat with theLink in theLinks
link theLink to dupMsg
end repeat
delete theMsg
end repeat
end tell
----------------------------------
--
Paul Berkowitz
MVP Entourage
Entourage FAQ Page: <http://www.entourage.mvps.org/toc.html>
AppleScripts for Entourage: <http://macscripter.net/scriptbuilders/>
PLEASE always state which version of Entourage you are using - 2001 or X. It's often impossible to answer your questions otherwise.
