Log of Rules that ran

Status
Not open for further replies.

Phil_

New Member
Outlook version
Outlook 2010 64 bit
Email Account
POP3
I'd like to create a log of rules that have run. I have 30 rules that each move new mail items to different folders by subject. I'd like to view the log to quickly verify certain emails have been received. I can then go to the appropriate folder to find the specific emails, but the GUI is slow whereas a script-generated log would be easier to scan via Awk or Perl.

Having read previous posts, I have created rules with the action "run a script" and specified "Project1.ThisOutlookSession.LogRule" as the script. I have tried as many components of the Outlook.MailItem as I can find using auto-complete, but I cannot seem to find a component that has the name (or ID) of the rule that is calling the script.

Here is my VBA code so far:

Option Base 1
Public Sub LogRule(Mail As Outlook.MailItem)
MsgBox "New mail item:" & vbCrLf & _
" Sender: " & Mail.SenderName & vbCrLf & _
" Subject: " & Mail.Subject & vbCrLf & _
" Rule ? : " & Mail.Session.Type & vbCrLf & _
".", vbOKOnly, "VBA Macro: LogRule"
'// cannot find property in Outlook.MailItem for Rule that was processed
End Sub

I had found a previous post from 1997 regarding custom actions in rules. See
http://www.slipstick.com/emo/1997/up970804.htm#custom
>>
One is called Launcher and was developed by Microsoft to demonstrate how to build custom actions. It is based on the CRARUN sample from the Exchange SDK. When the condition in a rule using Launcher is met, Launcher starts the program that you specify and passes it the ID of the message that triggered the rule.

Bundled with Launcher is a little program called ExPrint that prints a message based on the message ID passed to it by the Launcher custom action. ExPrint is written with Visual Basic using OLE/Messaging and stands as an example of how to write other VB routines that Launcher can trigger. You'll find Launcher and ExPrint at the Microsoft Exchange Applications Farm (ftp://ftp.microsoft.com/services/TechNet/samples/BOES/BO/MAILEXCH/exchange/appfarm/), with source code.
<<

I created a new path on my C: drive (c:\A\Microsoft). In the CMD window, I did "cd c:\a\microsoft". Then I started "FTP ftp.microsoft.com" and logged is as Anonymous (password is my email address), and did "cd xxx" for each folder in the path above, and got all the files (ZIP executables). [For FTP newbies, after you do the last cd, "cd appfarm", then do these commands: "bi" "prompt off" "mget *" and wait for the files to be downloaded, then close your FTP session with "bye".] According to "readme.TXT", Launcher and ExPrint are in the "printex.exe" (ZIP self-extracting file).

My problem is I am running Windows 10 64-bit, and PRINTEX.exe is a 16-bit application ... which won't run on 64-bit OS. Anyone still running Windows 7? Can you please extract the C++ source code for Launcher and ExPrint from this PRINTEX.exe, and send me the code (philirving@live.ca)? Then I can re-compile the source code for 64-bit OS.

Of course it is anyone's guess whether the Launcher code is still compatible with Outlook 2010.

Thank you in advance.
 

Phil_

New Member
Outlook version
Outlook 2010 64 bit
Email Account
POP3
D'oh! Answer occurred to me after posting this thread. I have 30 rules. Each rule should call a script named LogRuleNN (where NN=01, 02, .., 30). Each of those calls the main script MainLogRule and passes (byval) the rule ID, and (byvar) the mail item. Only question now is whether the code belongs in ThisOutlookSession or a main module...?

I don't need Launcher any more, since this should work fine. Just cumbersome to write.

Public Sub LogRule15(Item as Outlook.MailItem)
'// called by Rule 15
call MainLogRule(15, Item)
End Sub

Public Sub MainLogRule(byval MyRuleID as int, byvar MyItem as Outlook.MailItem)
MsgBox "New mail item:" & vbCrLf & _
" Sender: " & MyItem.SenderName & vbCrLf & _
" Subject: " & MyItem.Subject & vbCrLf & _
" Rule ID: " & MyRuleID & vbCrLf & _
".", vbOKOnly, "VBA Macro: LogRule"
End Sub

Thanks for letting me talk this out. See last question: does code belong in ThisOutlookSession or a module?
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
rather than using the individual macros to ID the rule, can't you use one and pass the rule name? (I'm not sure offhand.) The only thing is that if you are using run a script, the script should do all of the actions, otherwise it might skip some action.

(I seem to recall that launcher hasn't worked since Outlook 2003. )
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
does code belong in ThisOutlookSession or a module?
Run a scripts should be in a module. i've had a few that didn't work if put in thisoutlooksession, but most will work.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
Diane Poremsky Use PowerShell to log into Office 365 Exchange New Slipstick.com Articles 0
Diane Poremsky Log Messages and Attachment Names New Slipstick.com Articles 2
R Exchange - Locating a user that has log files but is not found using powershell Exchange Server Administration 1
B Exchange 2010 / Outlook 20070 "client error in synchronization log" Exchange Server Administration 1
C can't log chats in outlook? Using Outlook 1
M Messaged sent time in outlook differ from exchange log Using Outlook 2
Fozzie Bear Outlook 2010 wont remember Exchange Credentials on log off /shutdown of Win7 Exchange Server Administration 2
A How do I change the date created for a phone log BCM (Business Contact Manager) 1
R Phone Call Start Date - Phone Log BCM (Business Contact Manager) 1
B Good Call Log Concept? Outlook VBA and Custom Forms 5
M Phone Log Reminder to call back BCM (Business Contact Manager) 1
S Outlok 2007 add-in PJ Correspondence Log-How do I get it loaded? Using Outlook 7
L Re: Sharing database in network where computers have the same log- BCM (Business Contact Manager) 1
Aussie Rules Run a Script on an Incoming Email OK and then the Email reverts Outlook VBA and Custom Forms 0
R rules not working - done troubleshooting Using Outlook 0
P Outlook 2013 All imported Mail Rules in error when imported into new profile Using Outlook 5
A Apply Selected Emails to outlook rules and Run Rules Using Outlook 5
Wayne Outlook locks up when opening "Manage Rules & Alerts" Using Outlook 7
T "Words In Recipient's Address" Rule Causes Outlook To Stop Processing Rules Using Outlook 3
Retired Geek Junk Folder Clean Up Rules Exchange Server Administration 1
B Setting rules Using Outlook 1
A rules not working Using Outlook 2
M Rules and autoreply Using Outlook 1
N Outlook rules don't create a copy for bcc'ed emails Using Outlook 3
O How to recover rules after switch from POP3 to IMAP Using Outlook 2
N Focussed Inbox Rules Failing Using Outlook 5
N Copies of emails from rules have wrong from: account Using Outlook 0
L Office 365 cloud based rules Using Outlook 1
K Outlook Rules: Move a Copy Using Outlook 4
CWM030 Rules disappearing in OL 2016? ( Yes, I searched before posting) Using Outlook 7
R When rules lose track of "specified folder" Using Outlook 6
I Outlook 2013 Rules - (client only) Using Outlook.com accounts in Outlook 1
B When I add more search strings to RULES, it is not processing them Using Outlook 3
O Having rules run on old mails noved to inbox Outlook VBA and Custom Forms 8
A rules (flags) not working Using Outlook 7
K Lost Rules. Assistant accesses my mailbox. Disappeared Using Outlook 0
soadfan Outlook rules look up display name only Using Outlook 4
S Send email via SMTP - use transport rules to add to senders inbox (then rule to move to sent items Exchange Server Administration 1
Justo Horrillo Issue with rules in Outlook 2010 Using Outlook 4
J Outlook Rules - Changing auto-submit address in multiple rules, according to rule name Outlook VBA and Custom Forms 0
R When rules are working but invisible and unmanageable Using Outlook 2
P Transport Agent or Rules/Connectors Exchange Server Administration 1
A Rules - how to determine if all conditions in rule are true or false Outlook VBA and Custom Forms 5
EaglePI Outlook 2010 need help with rules Using Outlook 0
O Rules and Alerts for New Messages BEFORE sending Using Outlook 2
D Outlook Rules Using Outlook 1
Diane Poremsky Autoaccept a Meeting Request using Rules New Slipstick.com Articles 2
K adding more rules to 'different domains check' macro Outlook VBA and Custom Forms 2
Gunny NFOhiway Outlook PST file and Rules Using Outlook 1
M Outlook 2016 Rules Not Working Automatically Using Outlook 5

Similar threads

Top