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.
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.