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
G Outlook keep prompt for log in credential Using Outlook 1
J exchange 2010 error log Exchange Server Administration 0
B Trying to find &amp; run Scanpst.exe. Outlook can't log onto server. Have removed update KB2412171 &amp; it did not correct problem. Have done a resto Using Outlook 2
P DAG CONFIGURED Need to change the data base and log file location .What are the risk .And Steps to p Exchange Server Administration 3
P Exchange 2010 Backup using WSB not truncating log files Exchange Server Administration 5
T Outlook 2007 prompting users to log in Using Outlook 3
A Exchange 2010 DB - Unable to communicate with the Information Store to coordinate log truncation Exchange Server Administration 0
S Log Into Outlook Without Domain\Username Using Outlook 9
S exchange backup with dpm not truncating log file Exchange Server Administration 1
J Tool to analyze administrator and mailbox audit log entries Exchange Server Administration 1
V Extreme growing transaction log Exchange Server Administration 3
P Exchange 2010 - lost .log files and database .edb file refuses to mount Exchange Server Administration 1
J Move Transaction Log File Path Exchange Server Administration 1
M Exchange 2010 log error: MSExchangeMailboxAssistants 14029 FreeBusy Assistant Using Outlook 1
C Log all types of connection to a mailbox Using Outlook 2
M eseutil Operation terminated with error -528 (JET_errMissingLogFile, Current log file missing) Exchange Server Administration 1
P transaction log Exchange Server Administration 5
X SCOM alert on Exchange 2010 - Alert: The database copy isn't replaying log files fast enough for the Exchange Server Administration 2
F Need to fill in the password each time when log into outlook Using Outlook 3
L Windows Instant Search Indexing not working need help reading Event Log Using Outlook 2
J Mailbox Audit Log Exchange Server Administration 5
C Why do I have a Synchronization Log and get mail to this multiple times per day and why did it just start a few weeks ago? Using Outlook 1
M Sync Issues - Syncronization log in Outlook 2007 after mailbox move to Exchange 2010 from Exchane 20 Exchange Server Administration 11
A Outlook cannot log on. Verify you are connected to the internet & are using the proper server & mail Using Outlook 1
S location of outlook log file Using Outlook 1
R OWA log in as another account Using Outlook 2
I Mailbox Audit log don't return results. Exchange Server Administration 4
N outlook won't save my email log in passwords Using Outlook 5
J Public Folders: Outlook 2007 gets "The set of folder could not be opened. The attempt to log on to M Using Outlook 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
A When I log out of Outlook. The icon on the taskbar is greyed out and I am not able to activate/launch Outlook unless I reboot my PC. I have XP and am Using Outlook 2
B Good Call Log Concept? Outlook VBA and Custom Forms 5
M Phone Log Reminder to call back BCM (Business Contact Manager) 1
S Error: Cannot Open your default e-mail folders. You do not have permission to log on. Exchange Server Administration 16
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
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

Similar threads

Top