Email capture: OmniFocus 2 PRO with outlook 2016


#9

+1 for the Alfred workflow. It works nicely.


#10

Hi Justin, I just “upgraded” to Outlook 16.6 (the High Sierra version) and the script stopped working. Actually, it works 1-2 times, then does do anything unless you reboot the computer. Your script is the heart of my business workflow, I hope you can find an easy fix!


#11

@sbennett3705 - I noticed that it stopped working as well with the recent update to Outlook 2016 as well. I’m digging through the script to see what I can find so it will be a race between Justin or myself to get it updated.
;-)


#12

Microsoft suport is also looking into this. It appears Outlook 16 breaks all script, even the old ones supplied with Outlook 2011. In the meantime, I downgraded to 15.33 and am out of the Insider program.

I would guess it’s a matter of time before MS walks away from scripting, Apple is already doing so. It seems the preferred approach is an Office 365 plug in (like Evernote uses).

Thanks for any and all help!


#13

I wish Omni would write a proper Outlook add-in.


#14

So maybe I’m bagging my head against an immovable wall if the fault is in the app and not in the script itself.


#15

Hey OmniPeeps — I’m not going to be able to test this until I can update my system to the broken version (which is going to be a bit as I’m in the middle of a few projects), but maybe someone could try making the code adjustment below and report back here with results.

Change:

set theProps to (properties of selectedItem)

to:

try
        set theProps to (properties of selectedItem)
on error
        set theProps to selectedItem
end try

In terms of AppleScript in Office products, a member of their team told me a long time ago that they’re backing away from supporting it… getting rid of the menu bar was, in my view, the first step. I’d certainly love if they’d reconsider and, if you feel the same, I think you should bug them about it. :-D


#16

Thanks for the heads up on some of the changes. If MS is slowly backing away from Applescript, hopefully there’s another avenue coming with JXA or an Outlook plugin from Omni ( hint, hint ;-) )


#17

@Veritrope I tried your suggested fix with the latest Outlook (macOS) 15.38 and it works like a charm. Much appreciated!


#19

Microsoft support acknowledged the fact that scripts were not running under Outlook 16, the tech said they reported it as a “bug”. Let’s hope they actually follow up.


#20

Thank you so much. I replaced the line with the try-statement, and it works. High Sierra, OmniFocus 2 Pro, Outlook 2016. I also use Sven Fechners Alfred-workflow to activate the script: https://simplicitybliss.com/outlook2016-to-omnifocus-e7dd369080d9 (and actually use Keyboard Maestro to activate the workflow and change to OmniFocus and enter a : to the end of the newly added inbox item, since I like to have : to indicate there is something in the note field.

Before this modification that Veritrope/Justin posted, the script didn´t work. Now it works for me and I am productiva again. Thanks Justin!


#21

OK—I’ve updated the code on the script’s page and just sent out a tweet for more testers. Hopefully, everyone else has the same positive experience as @svendah and @patrickkamin! :-P


#22

Just an FYI - The script I have working still has the set theProps function to the original one line @Veritrope described above. I think the change made in @Veritrope script from referring to Outlook as application "Microsoft Outlook" to application id "com.microsoft.Outlook" was what fixed it for me.

Thanks again for keeping this script up to date @Veritrope!


#23

Considering this thread is somewhat old… i must be the silly one and couldn’t follow simple instructions … ;(

@svendah - are you able to re:post Sven Fechners Alfred-workflow as its probably preferrable. His link no longer works on his site with quite a few people asking the same?

@mygeekdaddy - the apple script seems from Veritrope site [it still refers to Outlook 2011 - not too sure if it’s the same for 2016 version] is updated as you’ve mentioned, however i was unable to find. "~/Library/Application Support/Microsoft/Office/Outlook Script Menu Items " - the folder doesn’t exist on my file directory under my users. Googling said that Outloook216 script was removed. Tried to put the script into Automator but my newbie-ness again failed as it failed with ‘Growl’ error line even though the script clearly points to no.

  • are you able to post the script here and any advice on steps please?

#24

Veritrope has updated his version at the link now. Thanks Veritrope.


#25

I just got this script working. Not sure where it went wrong but I had to comment out all of the quotes within the quoted variables. Mostly this was in the growl codebase (seems like it should be ripped out at this point…)

Anyway, I also rebuilt the Alfred workflow since Sven’s seems to have been pulled down.

You can get them both here.


Here's a link to a working script that saves an Outlook email as an OmniFocus task
#26

Thank you for creating the script and workflow. I had a terrible time trying to find a working script that imported Outlook mail to OmniFocus; your work did the job.

I’ve posted links to here from several places, including a top-level thread on this forum, for the benefit of future seekers.


#27

There is a bug in outlook 16.x that occurs when the Reminders window is open, the selectedItems property always returns 0.


#28

Guys,

This is working with Outlook version 16.16
Make sure you have Omnifocus Pro
Download Alfred
Purchase the power pack
Add a “Keyword to AppleScript” workflow
Set your keyword then on the AppleScript copy and paste the script below the ######

I’m also using an Outlook URL Handler so it will paste the message ID in the notes of the task. If you want this feature download this https://github.com/acidix/OutlookURLHandler/releases/download/0.1/OutlookURLHandler.app.zip
Put this in your applications folder and right click and choose open. This will give it authorization to work when you fire the workflow.

finally, select a message and trigger your workflow.

If you don’t want to use the URL handler then just remove “outlook:// & toOpen &” from the script

    on alfred_script(q)
  # Set due date to tomorrow by default
#set dueDate to (current date) + (1 * days)
tell application "Microsoft Outlook"
	# Will create tasks of all selected emails
	set currentMessages to current messages
	repeat with email in currentMessages
		# subject = task name, contents = task note, sender = context
		set subjectOfMail to subject of email
		set contentsOfMail to plain text content of email
		set fromSender to sender of email
		set senderOfMail to name of fromSender
		set toOpen to id of email
		tell application "OmniFocus"
			tell the default document
				set newTask to make new inbox task with properties {name:subjectOfMail, note:"outlook://" & toOpen & return & return & contentsOfMail}
				#set contextsList to (flattened contexts where name is senderOfMail)
				#if length of contextsList > 0 then
				#set context of newTask to first item of contextsList
				#else
				#set context of newTask to make new context with properties {name:senderOfMail}
				#end if
			end tell
		end tell
	end repeat
end tell
end alfred_script

#29

So awesome, thanks for sharing! It’d be even more awesome if there was a way to make the message link work on iOS. ;-)