Syntaxfrage zu Skript zur Outlookregelerstellung
Moin.
Habe folgendes VB-Skript:
Dieses soll nun erweitert werden um eine Ausnahme, siehe Bild:
Habt Ihr die Syntax parat für diese Ausnahme?
Habe folgendes VB-Skript:
Const RULE_NAME = "Move SPAM to SPAM Folder"
Const olRuleReceive = 0
Const olFolderInbox = 6
Dim olkApp, olkSes, olkCol, olkRul, olkCD1, olkCD2, olkMRA, oCurrentRule, blnFound
Set olkApp = CreateObject("Outlook.Application")
Set olkSes = olkApp.GetNamespace("MAPI")
olkSes.Logon olkApp.DefaultProfileName
Set olkCol = olkSes.DefaultStore.GetRules()
' Look to see if Rule Exists
blnFound = False
For Each oCurrentRule In olkCol
If oCurrentRule.Name = RULE_NAME Then blnFound = True
Next
' If the Rule has not been found, add it
If not blnFound Then
Set olkRul = olkCol.Create(RULE_NAME, olRuleReceive)
Set olkCD1 = olkRul.Conditions.Subject
With olkCD1
.Enabled = True
.Text = Array("***SPAM***")
End With
Set olkMRA = olkRul.Actions.MoveToFolder
With olkMRA
set .Folder = olkSes.GetDefaultFolder(olFolderInbox).Folders("SPAM")
.Enabled = True
End With
olkCol.Save False
End If
olkSes.Logoff
olkApp.Quit
Set olkMRA = Nothing
Set olkCD2 = Nothing
Set olkCD1 = Nothing
Set olkRul = Nothing
Set olkCol = Nothing
Set olkSes = Nothing
Set olkApp = Nothing
WScript.Quit
Habt Ihr die Syntax parat für diese Ausnahme?
Bitte markiere auch die Kommentare, die zur Lösung des Beitrags beigetragen haben
Content-ID: 377126
Url: https://administrator.de/forum/syntaxfrage-zu-skript-zur-outlookregelerstellung-377126.html
Ausgedruckt am: 02.04.2025 um 22:04 Uhr
9 Kommentare
Neuester Kommentar
Moin
Nur geraten:
Siehe:
Rule Object
Rule.Exceptions Property
RuleConditions Object
RuleConditions.Subject Property
TextRuleCondition Object
TextRuleCondition.Text Property
Nur geraten:
Set olkEx1 = olkRul.Exceptions.Subject
With olkEx1
.Enabled = True
.Text = Array("FW: ***SPAM***")
End With
Siehe:
Rule Object
Rule.Exceptions Property
RuleConditions Object
RuleConditions.Subject Property
TextRuleCondition Object
TextRuleCondition.Text Property
ungefähr so
set olkRul = nothing
' Look to see if Rule Exists
For Each oCurrentRule In olkCol
If oCurrentRule.Name = RULE_NAME Then Set olkRul = oCurrentRule
Next
If olkRul is Nothing then
Set olkRul = olkCol.Create(RULE_NAME, olRuleReceive)
end if
'kein Else !
If not olkRul is Nothing Then
Set olkCD1 = olkRul.Conditions.Subject
With olkCD1
.Enabled = True
.Text = Array("***SPAM***")
End With
Set olkEx1 = olkRul.Exceptions.Subject
With olkEx1
.Enabled = True
.Text = Array("FW: ***SPAM***")
End With
Set olkMRA = olkRul.Actions.MoveToFolder
With olkMRA
set .Folder = olkSes.GetDefaultFolder(olFolderInbox).Folders("SPAM")
.Enabled = True
End With
olkCol.Save False
End If