In Outlook 2013 (Windows 8.1) on receiving RSS messages, how do I add a rule to execute a script?

2

0

In Microsoft Outlook 2013 under Windows 8.1 I have various rules which execute several VBA scripts.

For this I have:

Files → Options → Trust Center → Macrosettings → Activate all macros

And also the registry entry:

HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Outlook\Security
DWORD: EnableUnsafeClientMailRules
Value: 1

Now I want incoming RSS feeds to trigger the execution of a script as well, but I can't make it work. (I am sure, that this had worked a while ago (2 years?), but that was on a different computer, to which I have no access any more. Possible Microsoft "security update" once again?)

Anyway, to add RSS feeds, I used

Files → Account settings → RSS Feeds → New

One such feed is

http://rss.cnn.com/rss/edition_europe.rss

The feeds work nicely, and messages are obtained as desired. By default, they go into an automatically created folder beneath my mail account on the left hand pane:

myname@mydomain.com
    ...
    RSS feeds
        ...
        CNN Europe

Now to create a rule, I use the blank rule template to create a rule for messages received by me.

In there is a selectable condition "from arbitrary RSS feeds". I select it, and on the next page I select "execute a script". I select the intended script and finish the rule.

The feeds produce messages, but the script is never entered (I put a breakpoint on the first executable statement).

I tried to change the location into which the feeds go, by using an alternate destination, so as to make it appear as if the feeds are part of my inbox.

myname@mydomain.com
    Inbox
        ...
        RSS
            ...
            CNN Europe

To no avail: the rule simply does not execute.

Any hints?

Herb

Posted 2017-11-24T05:56:23.360

Reputation: 673

Apparently a security update has disabled scripts. Check first if the setting to EnableUnsafeClientMailRules is still there or was somehow undone. You could also run the script directly via the NewMail or ItemAdd events, but it will need to be written in VBA.

– harrymc – 2017-11-27T20:30:44.913

I just checked, it is still there. But that must have been so, because its absence would not allow the appearance of the checkbox item to execute a VBA script. Remember, the VBA scripts applied onto emails just work fine and as expected. But I can not apply any VBA script on a folder obtaining RSS feeds. There is no error or so, the script is just not entered. – Herb – 2017-11-28T06:46:15.920

@harrymc, I use the MailItem object as in Public Sub ScanRSSPost(Item As Outlook.MailItem). Should I use another object? – Herb – 2017-11-28T06:51:48.857

I have not done this myself, but I know that NewMail or ItemAdd are more often recommended in this case than MailItem. – harrymc – 2017-11-28T07:40:52.350

@harrymc, you guided me into the right direction. If you make a proper answer out of it, I'd attribute the answer and the bounty to you. Solution: (1) Sub ScanRSSPost(Item As Outlook.PostItem), but this won't appear in the rules list. To make it appear, replace PostItem by MailItem which works, then (2) build the rule (on any RSS post, execute script ScanRSSPost), then (3) go back to the script and replace MailItem by PostItem (Outlook won't complain), then COMMENT THAT PROCEDURE IN THE SCRIPT! Thanks, mate. – Herb – 2017-11-28T08:54:53.287

Answers

1

A Microsoft security update has in effect disabled rule scripts, since Microsoft found it much easier to abolish them rather than tackle the security holes. This means that PostItem scripts cannot even be seen in the list when creating the rule.

Thus the remaining avenue is to use a VBA script with the NewMail or ItemAdd events which still work.

The poster reports this sneaky workaround as the solution which worked for him:

  1. Create MailItem script:

    Sub ScanRSSPost(Item As Outlook.MailItem)
    
  2. Build the rule as: On any RSS post, execute script ScanRSSPost.

  3. Go back to the script and replace MailItem by PostItem (Outlook won't complain).

harrymc

Posted 2017-11-24T05:56:23.360

Reputation: 306 093