'Outlook rule run in all the folders

I have a VBA script that is running a rule in outlook repeating the rule execution every 10 minutes. Is working like a charm, but I have a small problem, the rule is working just in the Inbox folder, and I need to work on all the folders. I tried with "IncludeSubfolders:=True" without luck. Here is my script:

Public Sub TriggerTimer(ByVal hwnd As Long, ByVal uMsg As Long, ByVal idevent As Long, ByVal Systime As Long)
Dim oOk As Outlook.Application

Set oOk = GetObject(, "Outlook.Application")
If Err.Number <> 0 Then Set oOk = CreateObject("Outlook.Application")
On Error GoTo 0

oOk.Session.DefaultStore.GetRules.Item("AssistantPlanifRobot").Execute

MsgBox "Rule run"
End Sub

and the timer part:

Public Sub ActivateTimer(ByVal nMinutes As Long)
  nMinutes = nMinutes * 1000 * 60 'milliseconds
  If TimerID <> 0 Then Call DeactivateTimer 'Check to see if timer is running before call to SetTimer
  TimerID = SetTimer(0, 0, nMinutes, AddressOf TriggerTimer)
  If TimerID = 0 Then
    MsgBox "The timer failed to activate."
  End If
End Sub

Does anyone have any idea?



Solution 1:[1]

By default, rules are run against the Inbox folder in Outlook.

Instead of relying on the rules in Outlook (end-user things) you can do everything in the code, so consider implementing the required functionality in VBA without rules involved.

Solution 2:[2]

Ok, solved the problem. Unbeknownst to me, a coworker was also working on this and for some reason pushed a bad classpath up to our repo, then I pulled it down, and he immediately fixed it. Stupidly, I didn't check for what was pulled down. After rebuilding the classpath it worked fine.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Eugene Astafiev
Solution 2 user348136