Does anyone have any info on the Outlook Object model?
Looking for a way to export rules into a human readable format (at least)?
TIA
I have managed to cobble the below together from snippets on the net, but TBH am getting lost. I am not a developer, but a dabbler.
Sub TestRule()
Dim olRules As Outlook.rules
Dim olRule As Outlook.Rule
Dim iRule As Integer, iAction As Integer, iException As Integer, iRuleAction As Integer
Set olRules = Application.Session.DefaultStore.GetRules
'Set olRule = olRules.item("TestRule")
For iRule = 1 To 1 'olRules.Count 'Each olRule In olRules
Debug.Print olRules.item(iRule).Name 'TypeName(iRule)
Debug.Print olRules.item(iRule).Enabled
Debug.Print olRules.item(iRule).Actions.Count
For iAction = 1 To olRules.item(iRule).Actions.Count
Debug.Print "ActionType: " & olRules.item(iRule).RuleActions.item(iAction)
For iRuleAction = 1 To olRules.item(iRule).RuleActions.item(iRuleAction).Count
Debug.Print "RuleACtions: " & olRules.item(iRule).RuleActions.item(iRuleAction)
Next
Next
Debug.Print olRules.item(iRule).Exceptions.Count
printArray olRules(iRule).Conditions.Body.Text
printArray olRules(iRule).Conditions.MessageHeader.Text
Next
Set olRules = Nothing
Set olRule = Nothing
End Sub
Private Sub printArray(ByRef pArr As Variant)
Dim readString As Variant
If (IsArray(pArr)) Then
'check if the passed variable is an array
For Each readString In pArr
If TypeName(readString) = "String" Then 'check if the readString is a String variable
Debug.Print readString
End If
Next
End If
End Sub