Adding tasks from within Outlook 2011 via Applescript - an approach

1 2 3 4 5 Next
Hi all,

ok, I'm currently trialing Things to see if it will fit my needs. As I'm using Outlook 2011 and get a lot of requests by mail, it was important to be able to add tasks to Things as reading through my messages.

As I wasn't able to find a solution that fitted my needs, I wrote a little Applescript to take care of it. It's not perfect (sort of my first Applescript "project") but I thought, I'll share it here anyway.

Just one condition to it : If you find bugs or ways to improve it, please keep me posted. ;)

I'll not copy/paste it as it has quite some lines to it, so here's the download link :

I've added some comments to it (explanation and setup instructions) but feel free to contact me or post here if you need help.

Hope it may serve some of you.


I admit I'm a bit surprised not even one person answered. Ok, never mind. I've been working a little bit more on my script today so the link of the first post now points to version 0.2 version 0.3.

It's a zip file containing the script, a readme and a little helper app to make the hyper-linking back to the outlook message more reliable, using a custom url scheme.

What does it do?
Select one or more messages in Outlook and fire the script using a key short-cut. For each of the selected messages, a new task is directly created in Things or the Quick Entry Pane pops up (Quick entry only if 1 message selected). The note section of the task contains the message text and a hyperlink back to the Outlook mail message.

Unless I get some requests or feedback, this will probably be the last (public) version.

Feel free to ask, if you need help.

I think few people use Outlook, hence the lack of response.
Well done on creating a script to meet your needs, and kudos for publishing it for others to use.
I'm in the process of migrating our work email solution away from Exchange 2003 - so I can finally make the transition to Outlook (away from Entourage).

Sounds like this script is going to come in useful when I get onto Outlook.


You are a godsend.

This is awesome, and makes my things->outlook so much better.

BTW, I am using an Exchange account, and the link seems to work for me, even after I've moved the email to another folder (but still on the exchange server)

Really - this is awesome....


Thank you LuMe96!!!

I tried the script and works great!
this link also shows ways to get to do's into Things via email.


I'll try the script - thanks for making it.

ok, I've been doing some further testing. The link back to the mail message should work (even after moving messages to other folders) for POP accounts and, according to dotterer for Exchange accounts (thanks for the feedback).
Unfortunately, for IMAP accounts (or at least my two accounts), moving a message to another folder breaks the link.
Here is why : To open the right message back in Outlook I use the Outlook message ID. If one moves a message to a different folder, Outlook deletes the local copy of that message and downloads a new copy from the new IMAP folder. At the same time Outlook assigns a new message ID to that message. I've been doing some further testing but up to now didn't come up with a solution to this issue.
If I do find something I'll keep you posted.
Yes, one could easily set up an account (or just some special keyword in the subject or body), then create a filter in Outlook 2011 to filter those messages and fire the script directly from within the filter.
You would just need to make sure to NOT have the Quick Entry Pane option set to 1 and to NOT ask for Tags.
That's actually one of the reasons I made those two options as settings. I do have some incoming mail (filtered on sender and subject) that ALWAYS ends up as tasks, so for those mails I don't even bother adding them manually but have a filter take care of it. ;)
Thank you very much, LuMe96!
You're welcome. ;)

Thank you so much for doing this. It works great. That's a virtual beer on me.
Sorry forgot to tag to follow... (done now :) )
+1 from me too
Thank you! Thank you! Thank you!

You've made my day. Works beautifully!
Hi! Thanks for your solution!
But i have some problems... after I have moved message to another folder on the server (exchange account), link is working some time, but then i see only appear and disappear outlookhelper in the dock. Any ideas?
Well as I wrote on the other thread, I use the unique Outlook-Message-ID that Outlook assigns to every mail.

I don't have an exchange account to test on, but on a simple IMAP-Server, that ID changes as soon as you move the message to another folder. This is because Outlook deletes the local copy in the old folder and downloads the message as "new" message in the destination folder, assigning a new ID to it.

I presume that something similar is happening with the Exchange account. Maybe some Exchange server mailbox clean-up task or mailbox compression scheduled every now and then.

I'm still looking for a different way to identify the message, a really persistent way, but for now without much luck to be honest.

Right now, my Things trial is over and I won't invest until cloud-sync is out, but I'll try to keep you posted if I find something.

may be i don't fully understand about Message ID and apple script... but ID from source of message does not change, may be there is the way to use this ID? anyway thank you again ;)
@CaHeKe :
you're right, that's why I wrote Outlook-Message-ID.

Outlook assigns an ID to every message. THis ID is different from the <Message-ID:> you'll find in every mail header.

The Outlook-Message-ID is available through Applescript and can be used to open a message. That's what my helper App does :
tell application "Microsoft Outlook"
open message id theID
end tell

Unfortunately that ID does change under some circumstances.

The <Message-ID:> you find in the mail header does not change. Unfortunately, it is not available to Applescript. You can extract it from the message header, but there's no way to open a message using this ID. You'll need to parse the Message header of all messages until finding the right message and open it. Takes way to much time.

However, Outlook also exposes an Exchange-Message-ID to Applescript. As I don't have an Exchange account this ID is empty for all of my messages, but might be the solution to your problem.
If I find some time these days I might have a look at it and keep you posted.
This is brilliant thanks.
I had stopped using Things since switching to Outlook and was using the internal task system which sucks compared to Things.

So thank you for allowing me to use Things again.

Was there no way to paste HTML at all?

My task emails (from a work ticketing system) are always html formatted with a basic table layout, it would have been nice to keep the format within Things.

Thanks again!
@spiderand :

you're welcome.

As to your question :
No, as far as I could tell from the dictionary and from tests, Things only supports plain text in its Note section (not even RTF as does TextEdit for instance).

Actually, when I retrieve the Message Body from Outlook, I get (badly formatted) HTML in the first place* and converting it to plain text (with accented letters getting converted correctly) was one of the hardest parts in the whole script. ;)


*(Apparently Entourage allowed extraction of the plain text part whereas Outlook 2011 does not have this function exposed to Applescript in its current version).
Thanks for clearing that up.

Awesome script!!!!
Absolutely fantastic script - just what the doctor ordered! Thank you Lutz - great job!

Fantastic Script.
Awesome, this was a huge help. I made a few tweaks to the script to not include the sender's name in the task name and to not include the body of the email (just the link to the original email) so it better matches the behavior with the Neither change is pretty enough to share but if others are interested I could clean it up and do so.
@dockbock, iCastilho & SLOBrewer :
Thanks for the kind words.

I'm glad the script finds some usage.

@LuMe96 great work.

I'd altered the textutil call to include -noload the it do not go to the network.

All in all brilliant.
did I do something wrong - cannot seem to get the appending '\cN' or any other shortcut for that sake to work when added to the great script.

So far I have only been using it as part of a filter and calling from the Script menu when needed. But would like to use the keyboard commands more.

didn't think about it, but the -noload might be a good idea indeed.

As to the shortcut pb, did you place the script into the "Outlook Script Menu Items" folder ? This folder should be located in :
<user>/Documents/Microsoft User Data/ (translated from french so might be different depending on your install language).
You should see the script listed in the Outlook Script Menu and the shortcut to the right :

@LuMe96 - my mistake with the scripts folder .... I did use the normal convention for script folders (silly of me - should have known better ,-)

again - nice work.
I did use the normal convention for script folders (silly of me - should have known better ,-)
Yeah, we're talking about M$ here so conventions ..... ;)

again - nice work
Thanks :)

came to think of one additional change/improvement. Have a folder identified to where the items would be moved prior to fetching the Message ID.
Unfortunately, this won't work:

As far as POP is concerned the Message-ID does not change so you can move the message as much as you like.

As to IMAP, when you move the message to a different folder, here's what happens :
1) Outlook sends a move instruction to the IMAP server
2) Outlook deletes the local copy of the message in the "old" folder
That's it !!!!!

Then, (as IMAP-IDLE does not work for folders other than the INBOX) Outlook will get the "new" copy of the message in the "new" folder only on the next scheduled sync. So depending on the sync schedule set up by the user, this can take up to 10 minutes or even more.
And only at that point, Outlook will assign a new Message-ID to the message.

Also, even if IMAP-IDLE was working and the message would be present in the new folder right-away, there would be no way to obtain the new Message-ID. For that to work, we would need a MOVE MESSAGE function which would give us the new Message-ID as a return value. Something like :
newMsgID = MOVEMSG(msgID,destFolderID)
Thank you so much for making this script. I would love to use it. It is the missing piece for me. I've got all my tasks in Things and emails in outlook. I want to get everything in Things.

The above link for your updated version of the script doesn't work. Can you check on that? I'd really love to have the new version.
Thanks again.
Sorry for that. Just re-activated the share for another 2 months. Should be fine now.

Excellent. That worked.

This is amazing! Thank you so much. I just got all my todo emails inside of Things in less than 1 minute. And I can click on the email link and close the task in Outlook just before i close it in Things. Incredible!
Hello Everyone,

I'm a new user, and I've tried to use this script but am having a bit of trouble. Could someone tell me why when I click on the link int he task in things it opens up "Mail" (with an error) instead of "Outlook". What am I doing wrong? Thanks in advance!

are you sure you're talking about my script(s) linked to in the first and 2nd message ?

There are two versions of my script (v0.1 in the first post, v0.2 in the second).

In v0.1 I link back to the message file on the Hard disk, i.e. a file having the .olk14Message extension. By default, this extension is assigned to Outlook.

In v0.2, I maintain the v0.1 way of working by option, but by default, I use a little helper script that in turn opens Outlook by Applescript.

The only way, I could explain the behavior you describe is that :
- you use v0.1
- you've by error changed the default application to open .olk14Message from Outlook to Apple Mail.

So your options are :
- either get and use v0.2
- and/or change the default application to open .olk14Message file back to Outlook.

Kepp me posted if you need further help.

Thank you very much for your reply. I'm using v0.2 of the script, but I imagine the default behavior on my system is to open "mail" using the olk14Message file. I don't think I ever changed it, but for some reason I'm still seeing this behavior. If you know how to change that back it would be much appreciated. Thanks again for your help. Searching...

this is more than strange. In the script, there's a line :
property useCustomURL : 1
could you please check if it's set to 1 (as above) or to 0 and report back ?

Ideally it should be set to 1, i.e. using the new way of opening messages. If it's set to 0, please change that to 1, SAVE, then try to make a new task (as it is not retro-active) and check the back-linking on that new task.

Also, to change the default application, you might want to do the following :
1) find a Outlook message file on your hard drive*
2) Right-click on the message file and choose the info view from the menu
3) Change default application to Outlook and click on the Apply to all button

* they are located in the <user>/Documents/Microsoft user data/Office 2011 identities/Main identity/messages/... (keep drilling down into the sub-folders)
1 2 3 4 5 Next

You need to be registered to post in this forum. Join now!