Scripting in Outlook – Stuck Draft messages.
I had a user complain about 500+ emails for an email distribution stuck in her outbox. My current environment is Outlook 2010 and Exchange 2007. I couldn’t figure out the reason for why they were stuck so I went down the basic troubleshooting steps.
- Opening one of them and clicking send – did not help
- Closing outlook and reopening – did not help
- Clicking on send/receive – did not help
- Moving the messages to another folder and dropping them back in outbox – did not help
- Setting outlook to offline mode and then going back online – did not help
- Recreated outlook profile on that users computer – did not help
- Opened the mailbox as my blackberry admin on another computer – did not help
- I even gave up and rebooted the users computer – did not help
After searching Microsoft forums, I did find that this is a common issue and some say the steps above helped them out, and others said it didn’t. I found a post where someone mentioned putting them into the drafts folder and opening the email and clicking send. This solution did work for me but there was no way that I was going to do this 500+ times, and I am sure my user wouldn’t either. I quickly searched and found a post on how to write a script to email all items in the drafts folder which turned out successful for me.
It took me a minute to figure out the parent folder name, so I commented that explanation into the
- Start Outlook and choose Tools, Macro, Visual Basic Editor (or press Alt+F11) to open the VBA Editor.
- In the Project window, select Project1 and expand the tree until you see ThisOutlookSession.
- Select ThisOutlookSession and press F7 to open the Code window.
- Enter the following in the Code window:.