The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniFocus > OmniFocus 1 for Mac
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Outlook Flagged Messages Thread Tools Search this Thread Display Modes

I've just read this article about sending flagged messages to omnifoucs. /links/send-flagged-mail-messages-to-omnifocus-automatically

I currently use outlook, i would like to do something similar.

I would like to mark messages as flagged on my iPhone/idevice, when they arrive in my inbox (or update to flagged) i want to send the main to my omnifoucs inbox.


1. mark as flagged, in outlook/iphone/ipad
2. search inbox every x mins / or based on an event? (ON MAC - so has to be running for this to work)
3. send selected messages to omnifoucs inbox
3. mark messages as unflagged

Any ideas?

Ive looking he dictionary for outlook there is a property followup seems to be the right one?

So for now i would just like to know how to list all flagged messages, i can do the rest.

I was thinking the exact same thing. Please share if you figure it out...
Hey Denno,

i downlaoded scriptbug from

i was able to debug the script with breakpoints and look at each object.

I then found the todo flag property of the message.

PHP Code:
--Assuming your message has been assigned to theMessage
set flagged to todo flag of theMessage 
as text 
you can then

PHP Code:
if flagged is "not completed" then
--do something amazing with flagged message
I now want to un-flag the message, but i dont know how to do that, (new to this applescript stuff)

OK this works:

PHP Code:
set todo flag of theMessage to completed 
now to tidy up and find some way to run its every x mins..

so im a little stuck with this script now.

i can get all the flagged mails from my account using the code below and send the flagged mail to omnifoucs:

PHP Code:
set thisAccount to exchange account "MYEXCHANGEACCOUNT"
set thisFolders to mail folder of thisAccount
    repeat with theFolder in thisFolders
if name of theFolder is "Inbox" then
            set selectedMessages to messages of theFolder
            repeat with theMessages in selectedMessages
if ((todo flag of theMessagesis not completedthen
--Send to OmniFoucs

end repeat
end repeat 
But its slow!

in the script i referenced you can do the following with the mail app:

PHP Code:
set _msgs_to_capture to (a reference to 
(every message of _inbox 
                    whose flagged status is true
Is this type of command available in outlook?
i can't get it to work

Is there a faster way to query the the database just to return the flagged emails?

Smart Folders have flagged mail in them, they return (within outlook) in a second. Does anyone know how i can access them?

Either via outlook apple script, or system events?

I've got the script to catch flagged new mail when they arrive via rules, however if the mail is already read then it will not catch it.

Originally Posted by wesley.elder View Post

But its slow!

Is there a faster way to query the the database just to return the flagged emails?
I have a solution working here:

property folderPath : missing value

set folderPath to ((path to home folder from user domain as string) & "oo2of:tmp") 
if (do shell script "/bin/test -e " & quoted form of (POSIX path of folderPath) & " ; echo $?") is "1" then
	-- 1 is false
	do shell script "/bin/mkdir -p " & quoted form of (POSIX path of folderPath)
end if

set msOutlookDataDir to "~/Documents/Microsoft User Data/Office 2011 Identities/Main Identity/Data Records/Messages/0T/0B/0M"

set timestampFileFullName_notposix to folderPath & ":timestamp"
set timestampFileFullName to quoted form of (POSIX path of timestampFileFullName_notposix)

set timestampFile to missing value
set newerString to ""
set touchString to " && touch " & timestampFileFullName
tell application "Finder"
	if file (timestampFileFullName_notposix) exists then
		set newerString to "-newer '" & timestampFileFullName & "'"
	end if
end tell

set cmd to "cd \"~/Documents/Microsoft User Data/Office 2011 Identities/Main Identity/Data Records/Messages/\" && find . -type f " & newerString & " -exec mdls -name com_microsoft_outlook_flagged -name com_microsoft_outlook_recordID {} \\; | grep \" 1$\" -A1 | grep com_microsoft_outlook_recordID | awk ' { print $NF } ' " & touchString

set cmdResult to do shell script cmd
set idsOfFlaggedEmails to paragraphs of cmdResult
this will populate idsOfFlaggedEmails with a list of the message (document) IDs that have been flagged since the last time the script was run. From here, you can script however wish to tell Outlook to act on those messages:

tell application "Microsoft Outlook"
	repeat with aMessageId in idsOfFlaggedEmails
		set theMsg to message id aMessageId
	end repeat
end tell

I got the idea to mine the metadata from the Data Records files on the filesystem from here:

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help? Send flagged messages to Omnifocus automatically, changing title/context based on from/subject jpr OmniFocus Extras 1 2012-10-15 07:24 PM
iPad with flagged tasks unavailable not appearing in Flagged Perspective bmushrush OmniFocus for iPad 0 2012-10-10 11:25 AM
Show only flagged tasks (not unflagged tasks in flagged projects) eurobubba OmniFocus 1 for Mac 5 2011-04-01 02:37 PM
Error messages... bheller OmniFocus 1 for Mac 5 2010-02-03 10:07 PM
Logs Messages torlundgren OmniDiskSweeper 0 2009-12-11 07:31 AM

All times are GMT -8. The time now is 12:19 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.