First, copy the script (below) to your local machine into your user folder ~/Library/Application Support/Microsoft/Office/Outlook Script Menu Items.
You can navigate to that path in a new Finder window by holding the Option key and opening the Go menu. You should see the Library option appear there. Now, just follow the path to the location mentioned above.
After you create the file there, create the file todoist-token.txt. In this file, you'll want to copy the API token from your account in Todoist. Open your browser, navigate and login to Todoist. Once you see your task lists, click the wheel and navigate to Settings. Once there, select Account. In the bottom half to the window, you'll see API token. Copy that token and place it in the file, todoist-token.txt. Make sure there are no new lines below the token. This will cause an error when parsing that file.
Once you have completed these two steps, it should be possible to open Outlook, select a message and send it to Todoist. Click the AppleScript icon in the menu bar and locate Todoist Task. Clicking this will automatically send it to Todoist and move the message in the folder "Archive".
Features of this script:
You can navigate to that path in a new Finder window by holding the Option key and opening the Go menu. You should see the Library option appear there. Now, just follow the path to the location mentioned above.
After you create the file there, create the file todoist-token.txt. In this file, you'll want to copy the API token from your account in Todoist. Open your browser, navigate and login to Todoist. Once you see your task lists, click the wheel and navigate to Settings. Once there, select Account. In the bottom half to the window, you'll see API token. Copy that token and place it in the file, todoist-token.txt. Make sure there are no new lines below the token. This will cause an error when parsing that file.
Once you have completed these two steps, it should be possible to open Outlook, select a message and send it to Todoist. Click the AppleScript icon in the menu bar and locate Todoist Task. Clicking this will automatically send it to Todoist and move the message in the folder "Archive".
Features of this script:
- Create a new task in Todoist.
- Create a new note on the Todoist with the body converted to plain text.
- NOTE: Todoist does not support HTML notes at this time.
- Archive the message to your "Archive" folder.
Also, view this script on github. For further enhancements and fixes - https://github.com/mhorner/OutlookToTodoist
(*Create Todoist task from email*)on replace_chars(this_text, search_string, replacement_string)set AppleScript's text item delimiters to the search_stringset the item_list to every text item of this_textset AppleScript's text item delimiters to the replacement_stringset this_text to the item_list as stringset AppleScript's text item delimiters to ""return this_textend replace_chars-- get todoist token from text fileset todoistToken to my replace_chars(read file ((path to home folder as text) & "Library:Application Support:Microsoft:Office:Outlook Script Menu Items:todoist-token.txt"), "", "")tell application "Microsoft Outlook"-- get the currently selected message or messagesset selectedMessages to current messages-- if there are no messages selected, warn the user and then quitif selectedMessages is {} thendisplay dialog "Please select a message first and then run this script." with icon 1returnend ifrepeat with theMessage in selectedMessages-- get the information from the message, and store it in variablesset theName to subject of theMessageset theSender to sender of theMessageset thePriority to priority of theMessageset theBody to content of theMessageif thePriority is priority high thenset thePriority to "4"elseset thePriority to "0"end if-- remove new lines from the body firstset theBody to do shell script "echo '" & theBody & "'| tr -d '\\r'"-- remove HTML tags from the body creating a plain text outputset plainText to do shell script "echo '" & theBody & "' | /usr/bin/textutil -stdin -convert txt -stdout"-- create a new task with the information from the messageset newItem to do shell script "curl -X POST -d 'content=" & theName & " for " & name of theSender & "' -d 'token=" & todoistToken & "' -d 'priority=" & thePriority & "' -d 'date_string=today' https://todoist.com/API/additem -d 'note=" & plainText & "'"set theAccount to account of theMessageset archiveFolder to folder "Archive" of theAccountmove theMessage to archiveFolderend repeatend tell