Auto Archive Script for Outlook 2011 for MAC

Kevin_mueller
New Contributor III

Hello Jamf Nation,

I wanted to as if anybody has a script, that can be used to autoarchive Emails in Outlook 2011 for Mac. Do you have any suggestions if it is possible somehow like this?:

tell application "Microsoft Outlook"
activate
set msgSet to current messages
if msgSet = {} then
error "No messages selected. Select at least one message."
error -128
end if
set theMsg to item 1 of msgSet
set theAccount to account of theMsg
set archiveFolder to folder "Archive" of folder "Inbox" of theAccount
repeat with aMessage in msgSet
move aMessage to archiveFolder
end repeat
end tell

A folderstructure has to be created under "On my computer" that is similar to the one in the Inbox. Emails have to be transferred to the folders on my computer and sorted correctly.

There is a program arround already, which unfortunately costs 20 Euro per licence:

http://blog.7thdomain.com/2012/09/03/auto-archive-script-for-outlook-mac-2011/

As we have to serve up to 2000 Macs, this won't be an option.

Thanks for any advice and best regards,
Kevin

2 REPLIES 2

johncwelch
New Contributor

Do you want to archive based on a manual selection, by date, by category?

That's going to be the biggest thing.

One point, as written, that's going to create the archive folder in the account the messages came in to. You may not actually want that if you want a local archive. To guarantee you're looking in the local storage, you use "on my computer" So the basics of what you want is:

tell application "Microsoft Outlook" set msgSet to the selected objects if length of msgSet ? 0 then display dialog "you must select at least one message to run this script" else set theArchiveFolder to folder "Archive" of on my computer repeat with x in msgSet move x to theArchiveFolder end repeat end if
end tell

You can check for that folder via:

tell application "Microsoft Outlook" if exists folder "Archive" of on my computer then beep else set theArchiveFolder to make new mail folder at on my computer with properties {name:"Archive"} end if
end tell

and then make the actual archive operation a handler for the script so you can slot it all together. Note that you want to specify mail folder, since on my computer can have multiple folder types.

Kevin_mueller
New Contributor III

Hello Johncwelch,

Thanks for your fast reply! I will come back to you as soon as we have any progress with suggestions and keep you informed.

Best regards,
Kevin