smneedham / OutlookMac-Archive-ExchangeToLocal

An AppleScript for Outlook Mac 2011 that makes up for the missing auto archive functionality typically found in Outlook for Windows
blog.7thdomain.com
48 stars 12 forks source link

Force Archiving of Items via tag "Archive" #8

Closed HBomb341 closed 10 years ago

HBomb341 commented 10 years ago

Force an archiving of an item from a tag of "Archive" - In short exact opposite of "Do not Archive"

HBomb341 commented 10 years ago

Spent the last half hour and got it -

Add

set doArchiveCategoryName to "Archive" -- If you create an Outlook category that has this exact name (case sensitive) and assign that category to messages or calendar events the archiving process will force those items indefinitely

-- Checks a categorizable item (e.g. calendar or mail item) for the presence of the 'Archive' category on forceArchiving(anItem) tell application "Microsoft Outlook"

    -- Check if item's category list for the 'archive' category
    -- [Wrote this procedurally due to problems with using 'every syntax' on category list]
    set catList to categories of anItem
    set foundArchive to false
    repeat with Y from 1 to count of catList
        set currentCat to item Y of catList
        if name of currentCat is equal to my doArchiveCategoryName then
            set foundArchive to true
        end if
    end repeat
    return foundArchive

end tell

end forceArchiving

Edit -

if (time sent of theMessage is less than earliestDate) or my forceArchiving(theMessage) then if (end time of calendarEvent is less than earliestDate) or my forceArchiving(theMessage) then