Auto Archive Script for Outlook Mac 2011

Posted: September 3, 2012 in AppleScript
Tags: , ,

Out the box Microsoft Outlook for Mac 2011 has no equivalent tool to the auto archive functionality found in Outlook for Windows.


I have now released a new tool for archiving in Outlook Mac 2011 which is a native Mac Application. It is significantly more stable, featured and faster than the AppleScript. It also supports archiving mail to the cloud (such as a GMail account) which keeps your archive safely backed up and accessible/searchable anywhere in the world. To download and see the features and screenshots of the new Outlook Mac Archive Tool go here
Installer DMG

It’s a significant improvement over the free applescript when comparing the features. If you’ve enjoyed the free AppleScript, please consider upgrading to Outlook Archive Tool even just as a donation for the hard work:

Feature Comparison

Feature Table


If you aren’t in the know: Archiving for Outlook is a process of automatically copying your full email folder structure and/or calendar events from the exchange server to a local folder structure on your computer. It’s used in scenarios like:

– Your company operates a data limit or ‘delete mail after x days’ policy which means you must move mail out of the exchange account to not cause disruption to your flow of mail (or to not suffer data loss of important mails in your past history)

– You want to keep your exchange account lean for performance reasons, but still be able to search gigs of mail going back many years

– You have a number of attachments in calendar events from years back that accumulate over time to lower the available data quota for email

– You aren’t happy with more manual methods of dragging mail down to your local storage when you happen to remember…etc

The search for a tool:

First stop was to Google for an AppleScript that would do the job. Though I found an simple implementation for Mac Mail there was nothing I could find for Outlook Mac 2011 that matched the features of the Windows version.

Commercial tools were poor at the time and after messing with Outlook Rules and finding them too weak I was inspired to create this script.


My new commercial tool for archiving in Outlook Mac 2011 is now available. It’s possibly the most featured on the market right now and the only tool to support archiving to the Cloud. You can read more here

Features of the script:

– A script which by default will archive mail from your primary exchange account using the following default archive settings:

  • Archive mail older than 80 days from all folders (except folders like ‘Subscribed Public Folders’, ‘Junk Mail’, ‘Deleted Items’, etc)
  • All archived mail folders will be placed under the folder of ‘On My Computer’ called ‘Archive Mail’
  • All non-recurring calendar items older then 2 years will be archived to a calendar of ‘On My Computer’ called ‘Archive Calendar’

– The script has a number of parameters which you can change if you are not happy with the default settings.

– Calendar and mail archiving can be configured separately, depending on your needs.

– Fire and forget: … using the ‘Tools’ menu in Outlook and ‘Run Schedule’ you can run the script on a regular basis.  For example, configuring a schedule in Outlook as depicted below will run the archive script daily.

– NOTE: Outlook by default hides your ‘On My Computer’ folder go to Outlook–>Preferences–>General and use below settings


Script [Ver 2.20]:

Change log 2012/12/08

– If you create a category in Outlook called “Do No Archive” there is a setting in the script that will now ignore any mails or calendar items assigned to this category even if they are candidates for archiving

– You can optionally enable a setting to not archive items flagged as Todo but are not yet marked complete even if they are candidates for archiving

– You can now archive recurring calendar events (but be warned that will remove the entire series even in to present day so use with caution)

– AppleScripts default timeout period that it waits for applications like Outlook to finish processing a task is quite short. The script now overrides this to 2 minutes by default but it can be made longer if you still experience timeouts (especially when you first run the script on a large mailbox and it has to process a long back log of archive items).

Script [Ver 2.13]:

Change log 2012/11/27

– Added in a simulation mode setting which allows you to review the empty archive folder structure created on ‘On My Computer’ without moving all the mail and calendar items (can be run repeatedly without issue). If run in the AppleScript Editor the candidate mail/events that will be moved once simulation is turned off are logged to the events window. This allows you to test out various parameters to the script to see the effect before archiving any items.

– Added in a new setting which allows you to archive sub-folders of excluded folders. Useful if you want exclude your inbox but still archive sub-folders of the inbox. By default this setting is not turned on and any excluded folder that is listed will also have it’s sub-folders ignored.

– Found that attempting to archive “sync errors” folders was causing the script to lockup. Updated the default exclusion folder to ignore this folder

– Timeouts can also occur on slower CPU machines when Outlook can’t move the mail quick enough for the speed of the script. Made this a parameter and increased it to 200ms delay between message moves. This mostly affects the initial archive processing when you have large back log of mail which can take a long time and is most prone to timeouts. When run daily this small speed delay will make very little difference. If you aren’t suffering from timeouts then you can change this parameter to .1 or zero seconds. [UPDATE:  In version 2.2 (to be released shortly) I have added an overall script timeout parameter too that, if increased, will stop the script from timing out when there are large volumes of mail to process (usually only on the first time you run the script on a large mailbox)

Script [Ver 2.12]:

Change log 2012/11/05

– For most users the script works flawlessly but a small percentage of users have problems detecting the Archive Folder or the Archive Calendar especially if they customise the script parameters. I can’t replicate the problem but this release is an attempt to fix the routine that creates these folder/calendars to see of it makes a difference

Script [Ver 2.11]:

Change log 2012/10/13

– When using the script for the first time on a large mailbox the script could lock up Outlook due to bug in Outlooks message move command. Outlook can’t handle the speed at which the script is sending move requests. By introducing a slight delay between processing of messages the script can now manage very large mailboxes (though it will take a little longer on first run)

Script [Ver 2.10]:

Change log 2012/10/06:

– Script now looks for the primary exchange account automatically which means if you are happy with the default archive settings (see blog post above) then it will just run out the box with no need to edit the script file and fill in exchange account name and other parameters (proving difficult for less technical users)

– Wrote a post on configuring the script for those that want to modify the default settings or other more advanced tasks

Script [Ver 2.0]:

Change log 2012/09/20:

– Added in the feature to optionally archive calendar events

– Can independently control the mail and calendar archive settings

Script [Ver 1.01]:

Change log 2012/09/18:

– The archive folder specified will be created if not found under ‘On My Computer’

– Attempts to fix the problem that on some Mac/Outlook versions this script fails to find the archive folder when it is created manually

Script [Ver 1.00]: 

– Initial release

Disclaimer: Free to use but 100% at your own risk (works for me)

Feedback/Bugs/Suggestions welcome

  1. Amit Singh says:

    Hi Michael,

    I am unable to run the script on my OUTLOOK 2011 for MAC it says “Can’t get exchange account “Amit Singh”. I don’t know why is it because that we don’t have a Microsoft Exchange Server but a Domain Email Provider (DreamHost) and we are using the IMAP to view our mails in the outlook.

  2. Angel says:

    Howdy I am so thrilled I found your blog, I really found you by error, while I was looking on Yahoo for something else, Anyways I am here now and would just like to say kudos for a marvelous post and a all round interesting blog (I also love the theme/design), I don’t have time to browse it all at the minute but I have book-marked it and also included your RSS feeds, so when I have time I will be back to read a great deal more, Please do keep up the superb work.

  3. delta search says:

    Howdy this is somewhat of off topic but I was wanting to know if blogs use WYSIWYG
    editors or if you have to manually code with HTML. I’m starting a blog soon but have no coding knowledge so I wanted to get advice from someone with experience. Any help would be greatly appreciated!

  4. Kai says:

    Hi Michael, thanks for doing the heavy lifting here! I received an applescript error: “Microsoft Outlook got an error: Can’t get «class pAMC» of exchange account id 1.” Any ideas on how to solve that?


    • Hi Kai, thanks glad it helped.

      I think I have actually figured the problem with that error that a number of people get. I only have one calendar in my Outlook but when people have more than one calendar the problem appears. I’m not sure why because I ask for the ‘default’ calendar so it shouldn’t be happening. So for now if you just want to use mail archiving then just use the options in the script to disable calendar archiving until I get to the bottom of this.

  5. Gordon says:

    Michael – Great script and many thanks for doing it… I have only 1 ask on it and thats can it show its progress on a progress bar somewhere? Or am i missing it? Thank you for this… As an old coder myself (back in the old procedural days!) love when people help other out with this. You do wonder why on earth MS couldnt do this in the product though…

    • Hi Gordon, thanks for the feedback 🙂 I’m also of procedural origins though I’m thinking of the next version being moved over to more OO scripting. Just need the time 😦

      Open to suggestions on where I could write out a status update but at a minimum I think I should write out a logfile.


  6. Michael Pierce says:

    Hi Michael – Thanks a ton for this script! Thankfully, my company let me switch to a Mac when my last Windows machine crashed. Unfortunately, there wasn’t much support in place at the time and one of my biggest issues was keeping my Exchange account underneath the quota. Your script has worked like a charm and kept me out of mail jail!

    One question for you: Is it possible to send archive email/calendar items to subfolders? For example, I’d like to have the following folder structure:
    On My Computer/Archive/2012/Inbox
    On My Computer/Archive/2012/Sent Items
    On My Computer/Archive/Calendar – for all calendar items

    I’ve tried revising the script value for localMailArchiveRootFolderName to “Archive/2012” and that didn’t work.

    Is it possible to do this?

    • Hi Michael

      Pleasure! 🙂

      I don’t create the archive folders recursively. I will need to mod the ‘CreateArchive folder’ routine for this.

      I can add this as a feature request list. One work around for now is you create a folder “Archive – 2012”

  7. Clark Chen says:

    It’s a great tool. Actually I have a very similar but slightly different task and I tried to modify the code you shared generous to complete my task. However, due to my very limited knowledge of Applescript, I failed with endless error messages.

    what I need is to upload local pop3 account’s email to an imap email account. So it is ‘upload’ from local to remote, instead of ‘archive’ from remote to local. I supposed it was a simple job, and started to write my very first applescript based on yours… however I could not make it – know too little of apple script. Hope someday someone can write one based on yours.

    Thanks anyway,

    • Hi Clark, I’ve actually written a basic one that did this but it has issues in that if you aren’t connected to the internet the object model of Outlook doesn’t tell you so writing to the IMAP account looks like it succeeded but actually it failed. You could therefore lose email that way. I was thinking of writing a ‘synchroniser’ to ensure that the mail actually arrived but this will take effort. I can share what I did do with you as it work but just has this one problem. If you want it drop a comment and I think I can see your email on the admin tool and send it over to you.

  8. Brian Eck says:

    Thanks for this! I was baffled as to why Mac Outlook said my mailbox was only using 60MB of space, while OWA said I was over 100MB – it was 40MB of old Calendar entries that are apparently invisible to the Mac Client.

    • Thanks Brian, glad it helped. When I started writing this I wasn’t aware either then one user asked for the feature based on this problem so it’s a new one to me too after all these years!

  9. Andrew says:

    Hi Michael,

    I’ve read through the posts and think I know the underlying reason why I can’t get the script to run, but rather than prejudice you with my amateur guess, I figure it’s worth posing the error first: –

    AppleScript Error: “Microsoft Outlook got an error: Can’t get item 1 of every exchange account. Invalid index.”

    Any thoughts as to what & why?


    • Hi Andrew have you tried just running the script out of the box without trying to manually set your exchange account name. It will auto detect your default account and then run. Let me know how you get on

      • Andrew says:

        Hi Michael. I did run it ‘out of the box’ without tinkering. When I started to tinker, I got different errors.
        I’ve also tried it with my IMAP account, substituting exchange references, but my scripting leaves much to be desired…

  10. Damon says:

    What about simply copying the emails to the Archive instead of moving them? My domain admin set up an auto-archive on the Exchange side, which works great on Windows (everything older than 90 days gets moved to an Archive which shows up along with the mailbox), but I can’t see that archive on my Mac. I would like my email to copy to the local archive folder on my Mac, so that it’s still available for the domain archive (and available on Windows PCs) but also copied to my Mac and available there.

    I tried simply changing the ‘move’ command in the script to ‘copy’ but Outlook didn’t know what that meant.

    • Hi Damon, it’s very simple to change the script to only copy instead of move mail. Change ‘move’ to ‘duplicate’

    • Damon says:

      It looks like changing this line:

      move theMessage to currentArchiveFolder

      duplicate theMessage to currentArchiveFolder
      will produce the desired effect.

      • Hi Damon, see Joe’s comments on the ‘Configuring Script’ thread from March 1 8:21pm. He found a way to allow the script to be run multipe times without causing duplicate mail. He sets the ‘Do Not Archive’ flag to true on all mail he’s made a duplicate of so that it’s ignored on next run.

  11. […] Auto Archive Script for Outlook Mac 2011 […]

  12. says:

    Hi Michael, i was looking for something like this via google and came accross your page, god only knows why MS have not included this as standard in 2011….I’ve passed this onto my colleague who is a MAC user and about 200 MB short of having is Outlook account locked for having a oversized mailbox…Great Job btw.

  13. Mr. Marty says:

    Thank you, thank you, thank you!!! You have saved me a whole lot of time re-tracing your steps to create my own archive script for Outlook. The script worked like a champ and your documentation made it super easy to get working.

    One thing that I wanted is the ability to archive the Inbox at a different (shorter) time period than the other folders. By keeping my Inbox lean, it forces me to move emails off to their more appropriate folders. I plan on keeping only 15 days of stuff in my Inbox, but 180 days in other folders.

    I took the liberty of modifying your script to add an “inboxDays” variable up front, which I pass in to the archiveExchangeFolders function. I use this value for mailFolderName == Inbox and the daysBeforeMailArchive value for everything else.

    The only other thing that would be nice to see is an ability to archive recurring events whose end date has past the archive window. I took a look at the properties for the recurrence end date and realize it’s a sizable effort … maybe when I have more time 🙂

  14. Hi Michael. Thanks for developing such a useful tool! Quick question: I want to be doubly sure that I never lose my archived emails. Presumably they will be backed up when I use Time Machine? But I would also like to use SugarSync to back them up – please could you tell me where in the Finder the Archive folder is created, so I can tell SugarSync to back it up? Many thanks indeed.

    • Hi Geraint, I can’t guarantee your data safety but here’s my best input on the topic:

      How outlook works on Mac (there’s not .PST file like windows):

      To backup your identity check these articles which talk about other things too but helpful in learning to manipulate Identities:

      If sugar sync is covering your identity folder then you should be ok in a hard drive crash.
      BUT if you ‘corrupt’ the folder then sugar sync will just ‘save’ your corrupted folder and you will need to look back in history to restore the non-corrupted version, so history is important too.

      Hope that helps

  15. Chris says:

    Hi Michael,

    The script seems to work, however I get:

    The script encountered “Microsoft Outlook got an error: Can’t get <> of exchange account id 1.” during execution.

    Any ideas?



    • Chris Owens says:

      Sorry, the info got stripped out. Please see screenshot:

    • Hi Chris, that error seems to relate to your calendar. Do you perhaps have a delegated calendar. Try disabling the calendar archiving it’s an easy setting in the script and see if that helps, then let me know and we can drill down further.

      • Chris Owens says:

        Hi Michael, that seemed to work and the script no longer makes Outlook hang for several minutes. Is there anything I can do to get around this (but keep Calendar entries in the archive)?

        • Hi Chris, thanks for letting me know. The calendar code is working for others so there must be something in your account I’m not catering for. It’s not a timeout (as in you have more items than the script can handle) but it’s literally not finding your ‘default’ calendar. Do you have any special calendar characteristics (delegated calendar, multiple calendars, etc?)

          The line of code giving the problems seems to be this:

          “set defaultExchangeCalendar to default calendar of exchangeAccount”…. but I can’t see why as it’s implying you don’t have a ‘default’ calendar

          • Chris Owens says:

            I’m not too sure Michael as it’s a corporate Exchange account. As far as I’m aware it does have delegates (as of yesterday) but I’m not sure it did before. I also have a few calendars of my co-workers pulled into my Outlook too.

    • Hi Chris, the ‘default calendar’ seems to not work with your scenario of multiple calendars. I’ll try add in some code to make it specifically select the calendar and see if that helps in a future release. Thanks for the feedback

  16. I’m trying to change the script to move the messages to another account I have that points to GMail through IMAP. I have changes on my computer to “Gmail”. But I get an error saying “Cannot get every mail folder of Gmail”. Is it possible?

    • Hi Thomas, sorry for the delay in getting back to you. Yes you can program against an IMAP account. Are you setting up your initial connection to the account as follows:

      (* set IMAP account *)
      set imapAccount to imap account “”
      set imapInboxFolder to mail folder “INBOX” of imapAccount

  17. waynegoldstein says:

    I am running the script and am getting Error Number:Microsoft Outlook got an error: AppleEvent timed out. -1712

    Any suggestions?

    • Hi Wayne, if you are running it on a very large mailbox then it can timeout. There is a setting to adjust Apple’s default timeout period fo scripts but generally I found that on very large mailboxes it’s easier to manually archive your mails and then use this script to keep it up to date incrementally. Let me know if changing the timeout worked.

  18. Michael, or anyone else:

    I’ve read through the script and modified the days from 80 to 20, because I don’t have emails older than 80 days. But after successfully running it with the “days=” set to 20, I can’t locate where the emails have been moved to. I tried to search for a folder named “Archive Mail” but still no luck. Any suggestions/help?

    (Sorry for posting in 2 different sections)


  19. Michael Pierce says:

    This is great, Michael! I just switched to a Mac at work…and this script is saving me from having to go back to a Windows machine! At this point, with the most recent updates, this looks to have all of the functionality I could ever want! Thank you!!

  20. Sirji says:

    This is fantastic.. had been looking for this for some time. Can’t understand why Outlook wouldn’t have such a system in place to begin with. I was starting to look for an Outlook API and see if I could write something in python but Applescript seems more suitable. This gives me a good reason to pick up some applescript 🙂

  21. Mark says:

    Any update on an IMAP archive option?

    • Hehe, hoped this had been forgotten about 😉 It has proved quite challenging with the fact that you can’t detect when you are offline from the internet resulting in message loss but I’ll take it further over the Christmas break and see if I can get a solution that can work within the limits of Outlooks IMAP API

  22. Larry Potter says:

    This is really great, thank you! Would it be possilbe to not archive flagged or emails marked for follow-up? I do a very quick archive (3 days) but emails that I don’t want archived (on my Windows machine) I set the follow-up flag on the prevent. I could just move to another folder and exclude that folder (which is what I’ll do for now) but setting the follow-up flag is eaiser. Thanks!

    • HI Larry, thanks 🙂 I’ll aim to add this in the next release 2.2 for you. I’m also at some point wanting to implement an option where you assign a message to a ‘do not archive’ category for those mails you want to keep around but don’t want marked as follow up. I’ll see how far I get.

    • Hi Larry, the feature you requested is in version 2.20 of the script. It now ignores flagged mail/calendar events that are not complete.

      You can also just create a “Do Not Archive” category to achieve the same effect but on items that you don’t want an open Flag on.

  23. Mark says:

    Great script. Really, really helpful, thank you so much. Is there a way to also archive recurring calendar invites? I tried hacking around with the script without much luck – I certainly don’t have your skills. Would be interested in your thoughts on this.

    • Hi Mark, thanks for the feedback :). I’ll add this feature in the next release 2.2. Probably not on by default but you can enable it through the settings

    • Hi Mark, I’ve released this in version 2.20 now. Just bear in mind that if you archive a recurring item from 2 years ago (like a birthday) it will remove all occurances to the present day too. The recurrance will then only be found in your offline archive calendar

  24. Jerry says:

    This is pretty amazing. Thank you! One question. It doesn’t seem like it is archiving the Sent Items folder. Am I correct? Do you know if this is possible?

    • Hi Jerry, yes it deals with all folders. Perhaps you are getting a time out while it’s doing the inbox so it’s not getting to your sent items. I am about to release a new version which makes some fixes for timeouts (happens to only a few people).

      Let me know if you still have issues

      • Jerry says:

        I think that could very well be it as I definitely seemed to be having issues that looked like timeouts…both when running the script from the AppleScript editor and when I ran it from Outlook. I was actually surprised when I saw that it had ultimately run successfully as it looked like my outlook was hosed (rainbow spinner). Could likely be due to the volume of mail that I have…almost 200K items between two folders. I had only run the initial test on a small subset by setting the date threshold far back, but I imagine you might still need to work your way through all of the items to find the ones where to start. I will watch for the update and give that a shot as soon as it is available. Thanks again.

        • Just released 2.13….see the changelog. Try running in simulation mode. If this runs successfully through all your folders then the problem you have is more todo with Outlook not handling the speed at which the script attempts to move mail. You can then try creating longer delays between each mail move to your archive. This will might make your first run last a few hours longer but atleast it has less chance of locking up. Another theory I have is that Outlook memory leaks on performing these actions so you just have to keep re-running the script (it will carry on from where it last left off) until your 200k mail are moved then you will be fine from there with the daily runs.

          • Jerry says:

            Thanks Michael. Just gave it a try in simulation mode and it errored out with the following:
            “error “Microsoft Outlook got an error: AppleEvent timed out.” number -1712″
            Outlook remains locked up at this point so would seem to be pointing at outlook as the culprit. I had doubled the processingDelay to .4 and had same outcome. Going to play around with the processDelay a little more and see if I can find a value that won’t have it lock.

          • Hmm…try excluding all root folders in your exchange account except your inbox or choose one or two other folders. I found that some folders that are being managed by ‘plug-ins’ or other tools installed on your computer that created sub-folders in Outlook can interfere with the script. e.g. Virus quarantine folders, microsoft communicator conversation folders etc If this solves the issue then gradually include folders until you find the problem one and let me know so I can exclude it out by default.

            Just bear in mind, I also took out the delay from simulation mode so you won’t see the effect of the changes you make to the delay unless you take it out of simulation mode. In hind sight this was probably a bad idea so might change that in future release.

          • My only other theory is that your mailbox is just so large that when I request the inbox array it’s timing out in building it up in the object model. I do it this way to avoid ‘filtering’ your mailbox down to the particular items as I found that even slower but maybe the filter method won’t timeout. I can send you a specific script with this method of selecting messages to try out as a last resort.

          • Jerry says:

            I excluded my main folder (150K messages) and it was able to get through everything else successfully in simulation. I am going to manually move the old messages over and then set your script up once I’ve got the messages down to a more reasonable number. Thanks again as this will be awesome to have so I don’t have to remember to do it after this first blast of cleanup.

          • Thanks for the debugging help Jerry. This script is unfortunately stuck with the limitations of Outlook’s object model….but perhaps I’m also missing a way to handle large volumes of mail, I just can’t see any other work around for selecting mail from the folder.

            I’ll note this limitation in the blog post so any future user can use the same work around for very large mailboxes.

        • HI Jerry, just to let you know that I found the problem which was the overall timeout of the ApplerScript engine while waiting for Outlook to process your large mailbox. I’ve now overriden the timeout to a new default of 2 minutes (but you can make it longer if you wish). So your work around sovled the problem but future users with large mailboxes will now fair better with this setting.

  25. Jason G. says:

    Have been looking for something exactly like this for a long time. Just wanted to leave a reply here to say Thank you!

  26. Bob B says:

    Hi Michael,

    Thanks for creating this script! Right now it’s not working for me the way I’d like, but that’s probably because I’m set up a little differently than most people. I already have a script that runs every time I receive a message that automatically moves it from my Exchange account inbox to a local “inbox” folder on my computer, due to our rather draconian mailbox size restrictions. But that just transfers the problem from my IT people to me…my local Inbox still gets huge very quickly. So I was hoping to use your script to cull my local Inbox (which is of course located under “Folders On My Computer”) to the Archive folder than I could then drag & drop out of Outlook as necessary.

    When I ran the script for the first time, it created the folder hierarchy under the “Archive Mail” folder, but all the folders in that hierarchy are empty, as if it did not traverse any of the folders “On My Computer”, and only looked at the mail on the Exchange server (of which there is very little). Do I need to tweak the script to make it work the way I want to?

    • Hi Bob

      Thanks 🙂

      I understand what you are trying to do. You basically want to make the script split your offline folders in to mail that is older than X days under an archive folder. The script solves a different problem. I’m a little short on time to mod it to your needs but closer to Christmas I can maybe look at it.

      Just one question? How will you deal with the archive mail once it gets large. I don’t think you can drag it off somewhere. You will probably have to export your whole set of offline folders to .olm file. You might also want to consider using the script as is and changing your model (even with draconian mailbox size) you can still archive off quicker using less than the default 80 days.

  27. Eils Gibney says:

    Mike – I would also like to run an auto archive and following your link I downloaded and tried the AppleScript.

    I received the following error message

    ‘Microsoft Outlook got an error: Can’t get item 1 of every exchange account. Invalid index.’

    Can you help?

    • Hi Eils

      Please give more information. Just to confirm the obvious but you do have an exchange account and not just running google mail or equivalent?

      Also did you modify the script in anyway before running? You can modify it but I perhaps you’ve put in the wrong description of your account or removed the auto detect option.


  28. Joel says:

    if you do not specify a path to archive mail where does it default to? I have tried the script and it works great I just can’t find where it is archiving my mail. The ‘On My Computer’ folder is not showing up in Outlook

    • Hi Joel, if you read the main post I give your instructions on how to ‘unhide’ the On My Computer folder. If you still have any issues let me know

      • Thomas says:

        Unfortunately, your Outlook archiving Applescript version 2.12 locks up on a new MacBook Air OS X Mountain Lion … it does indicate that it is running in the lowest field box, but I get the rotating rainbow circle -> locked up. I am trying to archive a rather large amount of email … I tried increasing the delay to 0.5 but that also did not work. Thank you.

        • Hi Thomas, try the latest script. A number of lock-up and timeout issues have been addressed in this version. Just bear in mind that if you have a very large mailbox the script can take a long time to run the first time as it has a lot to process.

  29. Ruan says:

    Hi, im struggeling to get the script to work. Keep getting an error: “Microsoft Outlook got an error: Can’t get exchange account “”.” This is my account name in Outlook?

    • Hi Ruan, apologies for delay in replying, I’ve been traveling. If you download the latest script and run it out the box it will by default find your main exchange account without you having to modify the script. It will archive all mail/folders older than 80 days to a folder under On My Computer called ‘Archive Mail’. Try that first and see if you get the error.

  30. Rishi says:

    Reblogged this on Rishi's Mind and commented:
    Very Very Very useful. Outlook turned out to be too cluttered for my daily use. In fact, I began losing email messages because of the amount of archive folders I had. After moving everything into 1 folder, I realized that there was no way to archive the rest of my mail in my current inboxes.
    If you have a lot of emails, spotlight will take a perfomance hit and show a tonne of mismatches. Archiving emails somewhat prevents this from happening.
    Happy archiving!

  31. Bob says:

    Thank you!!! This worked perfectly. My recommendation to others is if you have a long history of years in your calendar and you could care less on archiving them, delete prior to running script as it can take a very long time on the initial pass-through.

    • Thanks , Bob appreciate the feedback and glad it helped.

      Agreed on performance it’s not the fastest script as I had to slow it down due to Outlook locking up if I throw too much at it.

      It processes an event every 100 ms to keep Outlook happy.

  32. Maria Bäck says:

    Hi Michael, your script and solution looks very promising! 🙂 I have one question: you mention that emails should be sorted ‘date sent’ instead of ‘date received’. What if I have folders sorted ‘by conversation’? Will this screw up the date in the archive folder? Thanks! Maria

    • Hi Maria, thanks for the postive feedback. Good question too. I tested this by I ordering by attachment size and various combinations and it still archived by oldest date order so script is unaffected 🙂

  33. selectiveins says:

    Michael Thanks a lot for the script. As I understand this will help me archive emails older than 80 days from my exchange inbox to an archive *.olm) file on my computer.

    I have multiple folders(with emails) in my outlook client corresponding to each quarter(Q1-2011, Q2-2011 etc) on my local archive on ‘My Computer’, which exist as individual files. Can I use this script to archive each of those folders into a mac data file. i.e. Q1-2011.olm, Q2-2011.olm?
    Please help

    • Hi Seletiviens, this script will mirror the folder structure you have on your exchange account down on to your ‘My Computer’ for items older than 80 days (you can change this to another value if you want). So if you have quarterly folders in your exchange account then these will automatically be created on your computer during the archive process. The folders are all created in your outlook database, which is not an .olm file but actually a lot of files (each mail is in it’s own file for example). You can manually export a snapshot of your current Outlook database to a single .olm file as a way of backing up to alternative storage but you can not create a .olm just from a single folder (it’s all or nothing). If you use categories you can just select items of a category for the .olm (so maybe categorising by quarter will work for you ).

      Alternatively you can drag a single folder to your desktop and it creates a .mbox file. This can be later imported but it only backsup that one folder and ignores sub-folders so it’s very limited.

  34. Geoff says:

    I guess this is basic to all of you guys on here. But I need to ask “what is an exchange account”? I’m just using gmail and would love to be able to get this to work as mails are just piling up inexorably.
    How does a person get the exchange account? While keeping gmail working as nicely as it does…

    • Hi Geoff, for all intensive purposes you can think of an exchange account as the equivalent of a gmail account but it’s from Microsoft. Exchange is an enterprise server platform allowing companies to host their own mail infrastructure. It’s probably powers most of the corporate worlds email right now for larger companies.

      Today there are more choices like Google Apps which offers businesses solutions for hosting their email (similar to the consumer focused Gmail platform). It comes with tools for administrating and managing accounts etc. CIO’s trade off between Exchange and Google around total cost of ownership, governance, privacy, east of use etc

      You and number of people have asked for an archive solution for non-exchange type email accounts (Gmail, Yahoo etc….often referred to as POP or IMAP accounts). I’ll do some research but in principle should work just the same as this script for exchange. I’ll let you know when it’s done.

  35. […] Auto Archive Script for Outlook Mac 2011 Archives […]

  36. donovan says:

    Thank you so much for this script!

  37. Kent says:

    Brilliant. That’s all I have to say! Thank you!


  38. ricci walker says:

    greetings Mike,
    nice work, will it also work on a normal outlook 2011account ?
    happy to edit the script if you give me a clue where?



    • Hi Ricci

      It’s exchange specific but it could be modified to work with an IMAP account by working through it. Most of the logic should be still apply.

      I’m considering a version which synchronizes your email to gmail as a type of archive in the cloud for non gmail based accounts


  39. Nick says:

    Hi Michael.
    Your script sounds great. Unfortunately I may have misunderstood one of the set-up instruction in the script and all I get is this error: “error “Microsoft Outlook got an error: Can’t get exchange account \”\”.” number -1728 from exchange account “”.
    OWG Exchange is the greyed out name of my Exchange Account within Outlook.
    Can you please help me get unstuck?
    Cheers, Nick.

    • Will do, just isolated from decent bandwidth to upload a guide with photos (sitting in thatch hut here in the bush watching a waterhole, with edge speed from nearby camp). I’ll be back in city civilization Monday to put a proper guide together and get it working for you. ( Or you may have discovered a bug as your account name has spaces in it….I’ll test that)


    • HI Nick I’ve written a guide for configuring the script OR you can download the latest script which auto detects your exchange account for you. Hopefully should just run out the box if you are comfy with the default archive settings (see details in post)

  40. Paul says:

    Many thanks! This script is exactly what I was looking for when I entered “Outlook 2011 archive”, it would have been better if it was built into the product, but this script is a very close 2nd place!

    Thank you, thank you, thank you!

  41. germaine says:

    Hey Angela, just save the downloaded script to a folder that you won’t delete it (I put mine in Microsoft User Data\Outlook Script Menu Items). Then from Tools > Run Schedule > Edit Schedule, click the + at the bottom to add a new Schedule.

    In the pop-up window, key in a name (Auto Archive) I put mine as When > Manual run (yes even though it’s meant to AUTO Archive); Action > + Add Action > select Run Apple script. Click on the script button, which will allow you to select Mike’s script from the folder you have it saved in.

    Ensure Enabled is checked. Et voila

  42. Angela Norton says:

    Hi Mike
    My outlook appears to go through the motions of archiving (it runs a progress bar when the rule is applied) but nothing is in the archive folders. So I have downloaded your script but as a designer I have no idea what to do with it !! I seems to need info putting in it – but what and from where?
    Sorry I am just trying to get around this “your inbox is full” message we get from our exchange server.


    • Hi Angela

      Sorry you are struggling, it is a little Geeky to make it work 🙂 ….Just about to fly from South Africa to New York for a conference right now so ill write you a tutorial in a day or so ( or might have time at airport)

      • Michael says:

        Hi Michael,

        I really could do with the solution you seem to have come up with for Autoarchiving in Outlook 2011 for Mac but as an absolute novice when it comes to this sort of thing I am typically struggling.

        I have set up most things as per your instructions however am stumped at the point where I should edit the Global parameters in the script – I am not sure exactly where in the global settings I should be entering things eg I tried deleting the word “exchange” from under the General section of Global Settings and replaced it with my email address in parentheses.

        This didn’t seem to work. Your help would be much appreciated. Cheers Michael

        • Hi Michael, Angela and others needing a guide.

          Sorry for delay in getting back to you. I’ve been traveling.

          I have written up a guide but sitting on vacation in a remote part of South Africa with low connectivity on my phone only. The moment I get bandwidth higher than edge I’ll upload it.


      • Hi Angela, the guide has been posted OR you can download the latest script which will automatically detect your exchange account and run without any editing if you are ok with default archive settings, see the post above.

  43. Jim MARTIN says:

    Damn.. that was fast. Again, simple and elegant… no wasted lines of code. It does exactly what is needed.

    I’m working on a couple of edits, one is a simple adjustment that would exclude messages from the archive if the messages is tagged with a specific “category” label (like “DoNotArchive”). It requires a new global setting.. but.. other than that, it isn’t much of a departure to your code model.

    I’m also working on a GUI to handle the customization of the script, greatly simplifying the customization and installation operation.

    Much appreciate the quick adjustments you mad..


    • Excellent, thanks Jim!

      Great ideas, if you are happy to share would be good to co-author with you to perfect this puppy

      Might be better for me to put this thing on GitHub (source control environment) so anyone can pull down the latest release and make a contribution to improve.

      I’ve never done GUI work (only a couple of weeks fresh in to AppleScript coding) so would be keen to see how that works


  44. Jim MARTIN says:

    Nicely done. I was just sitting down to build an AppleScript to archive Outlook4Mac, but you beat me to the punch and saved me a ton of work.

    One of the things that really plagues Mac users is my company is the weight of attachments in calendar events. Have you thought about adding archive capability to the calendar in a future release? Even if it’s a separate script, it would have a pretty significant value. ??

    • Thanks Jim, a ton of people looking for this solution so spread the word.

      Also, let me know if anyone in your company has any problems with it, some folks were having an issue with the script not finding the archive folder but after 1.01 update it seems to be fine now but the more feedback the better.

      Love a challenge so I’ll look in to the Calendar problem and see what I can do

      I’m also irked by the way signatures work in that you can’t isolate it to only new emails (it always inserts it even on replies and forwards). Wondering if I can fix with script or if anyone knows of a solution out there.

    • Hi Jim

      Modified the script to archive calendar events for you, just download ver 2.0 (…also see new description to post above, change log and script comments on how to set the new parameters)


  45. Ben Huber says:

    Thank you VERY much. IT has been breathing down my neck to keep my account under 1GB. I like the comfort of keeping old emails, so this is GREAT. Thanks for doing the legwork.

  46. Patrick Schütz says:

    Unfortunately the script don’t work on my mac.

    I get the following error message:
    error “„Microsoft Outlook“ hat einen Fehler erhalten: „mail folder \”Archiv\” of on my computer“ kann nicht gelesen werden.” number -1728 from mail folder “Archiv” of on my computer

    I have created a folder named “Archiv” directly under on my computer as root folder..

    I hope you can help me, thanks in advance!


    Patrick Schütz

  47. Patrick Schütz says:

    Hi there,

    thanks for the script, it is very useful.

    Unfortunately the Image don’t work anymore, I’m getting an 404 error message from the server.


    Patrick Schütz

  48. Mark says:

    Maybe I’m missing something but I can’t get this to work! I created a folder called Archive under the “On my computer” (which is just below my Inboxes). set localArchiveRootFolderName to “Archive” — name of the root archive folder under ‘On My Computer’

    I get an error saying it can’t find the “Archive” folder. Any ideas please?

    Many thanks!

    • I think the problem is you haven’t created the your ‘Archive’ folder in the root of ‘On My Computer’. It’s probably one level in under your ‘Inbox’ folder of ‘On My Computer’

      The code that searches for your archive folder is:

      mail folder localArchiveRootFolderName of on my computer

      You could change this to be

      mail folder localArchiveRootFolderName of mail folder Inbox of on my computer

      …but I haven’t tested this so ideally just create your ‘Archive’ folder at the top level of your ‘On My Computer’


    • Hi Mark

      See my answer to Patrick Schutz who had a similar problem. Please let me know if it also solves your problem


  49. Jason Fisher says:

    You are awesome!!! Thank you very much!! Works Perfectly!! Why couldn’t Microsoft think of that!!!

    • Hi Jason, feedback appreciated 🙂

      Agreed, considering I’ve never coded in AppleScript and it only took a couple of days to write you would think Microsoft would include something like this as its a significant feature of Outlook for most people.

      Anyway, just glad it works!

Leave a Reply to Mr. Marty Cancel reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s