找到这个可以向Outlook添加规则的优秀脚本但是我想创建以下规则并想要一些帮助修改
Outlook规则: 消息到达后应用此规则 邮件标题中包含外部 将其分配到 EXTERNAL 类别
Const RULE_NAME = "test"
Const olRuleReceive = 0
Const olFolderSentMail = 5
Dim olkApp, olkSes, olkCol, olkRul, olkCD1, olkCD2, olkMRA
On Error Resume Next
Set olkApp = CreateObject("Outlook.Application")
Set olkSes = olkApp.GetNamespace("MAPI")
olkSes.Logon olkApp.DefaultProfileName
Set olkCol = olkSes.DefaultStore.GetRules()
Set olkRul = olkCol.Item(RULE_NAME)
If Typename(olkRul) = "Empty" Then
Set olkRul = olkCol.Create(RULE_NAME, olRuleReceive)
Set olkCD1 = olkRul.Conditions.From
With olkCD1
.Enabled = True
.Recipients.Add olkSes.CurrentUser.Address
.Recipients.ResolveAll
End With
Set olkCD2 = olkRul.Exceptions.ToOrCc
With olkCD2
.Enabled = True
End With
Set olkMRA = olkRul.Actions.MoveToFolder
With olkMRA
.Enabled = True
Set .Folder = olkSes.GetDefaultFolder(olFolderSentMail)
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