Create a gist now

Instantly share code, notes, and snippets.

Embed
Permanently delete Outlook for Mac messages
tell application "Microsoft Outlook"
set theMessages to the selection
permanently delete theMessages
end tell
@talkingmoose

This comment has been minimized.

Show comment
Hide comment
@talkingmoose

talkingmoose Nov 6, 2011

Instructions:

  1. Open the AppleScript Editor application found in /Applications/Utilities.
  2. Copy the above four-line script and paste it into a blank AppleScript Editor window.
  3. Select problem messages in Outlook for Mac.
  4. Click the Run button in AppleScript Editor to execute the script and delete the messages.
Owner

talkingmoose commented Nov 6, 2011

Instructions:

  1. Open the AppleScript Editor application found in /Applications/Utilities.
  2. Copy the above four-line script and paste it into a blank AppleScript Editor window.
  3. Select problem messages in Outlook for Mac.
  4. Click the Run button in AppleScript Editor to execute the script and delete the messages.
@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Oct 5, 2014

Thank you but not working, I followed your script instruction and this error message existed:
error "Microsoft Outlook got an error: Can’t make missing value into type message." number -1700 from missing value to message

ghost commented Oct 5, 2014

Thank you but not working, I followed your script instruction and this error message existed:
error "Microsoft Outlook got an error: Can’t make missing value into type message." number -1700 from missing value to message

@Shuhkoh1

This comment has been minimized.

Show comment
Hide comment
@Shuhkoh1

Shuhkoh1 Jan 1, 2015

I also get a Script error: Microsoft Outlook got an error: Can’t make {outgoing message id 161304, outgoing message id 170700, outgoing message id 179073, outgoing message id 181751, outgoing message id 183661, outgoing message id 185209, outgoing message id 187285, outgoing message id 189011, outgoing message id 189296} into type message.

Shuhkoh1 commented Jan 1, 2015

I also get a Script error: Microsoft Outlook got an error: Can’t make {outgoing message id 161304, outgoing message id 170700, outgoing message id 179073, outgoing message id 181751, outgoing message id 183661, outgoing message id 185209, outgoing message id 187285, outgoing message id 189011, outgoing message id 189296} into type message.

@NeilLowe

This comment has been minimized.

Show comment
Hide comment
@NeilLowe

NeilLowe Mar 13, 2015

Try this:

tell application "Microsoft Outlook"
set theMessages to the selection
repeat with theItem in theMessages
permanently delete theItem
end repeat
end tell

Try this:

tell application "Microsoft Outlook"
set theMessages to the selection
repeat with theItem in theMessages
permanently delete theItem
end repeat
end tell

@bdonsite

This comment has been minimized.

Show comment
Hide comment
@bdonsite

bdonsite Apr 8, 2015

Still didn't work. Thanks for trying

bdonsite commented Apr 8, 2015

Still didn't work. Thanks for trying

@ManSinha

This comment has been minimized.

Show comment
Hide comment
@ManSinha

ManSinha Apr 19, 2015

@NeilLowe
Thank you for posting that script. I got an account here specifically so that I could say "thank you" to you.
May I ask how did you come about it?
Thanks

@NeilLowe
Thank you for posting that script. I got an account here specifically so that I could say "thank you" to you.
May I ask how did you come about it?
Thanks

@lanterneRouge

This comment has been minimized.

Show comment
Hide comment
@lanterneRouge

lanterneRouge Dec 1, 2015

I have accidentally discovered a way round the script error descibed above.

I have some 2012 emails stuck in a local sent items folder, and I also got an error with this script:
Microsoft Outlook got an error: Can’t make {outgoing message id 18809, outgoing message id 18795 ...... outgoing message id 17890, outgoing message id 17793} into type message.

I had a look in Outlook's Main identity folder, and for all the message ids listed that I checked there was no message file in Data Records/Messages, but there is a Message Source file. However, when opened, the source files were for 2014 emails.
This led me to think that, assuming the error message ids correspond to the ids in the Main Identity folder, the 'stuck' messages (or Outlook's index) may be corrupted in a way that makes them appear to have a different id. (Rebuilding the database doesn't help at all with this issue.)

When I tried testing the script on a single message to identify its id, the script worked!
Selecting even 2 messages caused the error, but I was able to delete all the problem messages one at a time with this script.

I've left all the info about messages and source above in case it helps anyone else get to the bottom of it, but if you get the error, try using the script on your emails one at a time.

I have accidentally discovered a way round the script error descibed above.

I have some 2012 emails stuck in a local sent items folder, and I also got an error with this script:
Microsoft Outlook got an error: Can’t make {outgoing message id 18809, outgoing message id 18795 ...... outgoing message id 17890, outgoing message id 17793} into type message.

I had a look in Outlook's Main identity folder, and for all the message ids listed that I checked there was no message file in Data Records/Messages, but there is a Message Source file. However, when opened, the source files were for 2014 emails.
This led me to think that, assuming the error message ids correspond to the ids in the Main Identity folder, the 'stuck' messages (or Outlook's index) may be corrupted in a way that makes them appear to have a different id. (Rebuilding the database doesn't help at all with this issue.)

When I tried testing the script on a single message to identify its id, the script worked!
Selecting even 2 messages caused the error, but I was able to delete all the problem messages one at a time with this script.

I've left all the info about messages and source above in case it helps anyone else get to the bottom of it, but if you get the error, try using the script on your emails one at a time.

@VisualNation

This comment has been minimized.

Show comment
Hide comment
@VisualNation

VisualNation Jan 14, 2016

Thank you sir. Worked perfectly.

Thank you sir. Worked perfectly.

@win-lee

This comment has been minimized.

Show comment
Hide comment
@win-lee

win-lee May 31, 2016

Thanks, helped me too. Worked perfectly.
Still don't knot why these messages couldn't be deleted, but they are gone now :-)

win-lee commented May 31, 2016

Thanks, helped me too. Worked perfectly.
Still don't knot why these messages couldn't be deleted, but they are gone now :-)

@imSeva

This comment has been minimized.

Show comment
Hide comment
@imSeva

imSeva Jul 10, 2017

Hi,

I have a meeting invite that is stuck in the outbox and can not delete it using the script. I receive this error message:
+++++
Result:
error "Microsoft Outlook got an error: calendar event id 6151 doesn’t understand the “permanently delete” message." number -1708 from calendar event id 6151
+++++
Is there another command I need to use to delete a meeting invite vs. a message?

Thanks

imSeva commented Jul 10, 2017

Hi,

I have a meeting invite that is stuck in the outbox and can not delete it using the script. I receive this error message:
+++++
Result:
error "Microsoft Outlook got an error: calendar event id 6151 doesn’t understand the “permanently delete” message." number -1708 from calendar event id 6151
+++++
Is there another command I need to use to delete a meeting invite vs. a message?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment